chuckp@ncr-fc.FtCollins.NCR.com (Chuck Phillips) (02/13/90)
On 7 Feb 90 20:25:41 GMT, karl@haddock.ima.isc.com (Karl Heuer) said: I forget who> Compilers should NEVER rearrange computations. Karl> As long as they get the right answer, they may; as long as it's a Karl> desirable performance improvement, they should. Agreed. In the spirit of C, the compiler _should_, by default, have the freedom to rearrange an expression (take advantage of distributivity, etc.). However, there are times when you _really need_ to explicitly control the order and means of evaluation. Serious: Anyone for casting an evaluation critical expressions to type "volatile"? It's too late for ANSI C. ISO C, perhaps? Un-serious: Then again, how about: extern "forth" ? :-) Just kidding! See the smilies? -> :-) :-) :-) :-) :-) :-) :-) :-) :-) -- Chuck Phillips -- chuckp%ncr-fc.FtCollins.NCR.COM uunet!ncrlnk!ncr-sd!chuckp%ncr-fc
karl@haddock.ima.isc.com (Karl Heuer) (02/15/90)
In article <CHUCKP.90Feb13065634@halley.ncr-fc.FtCollins.NCR.com> chuckp@ncr-fc.FtCollins.NCR.com (Chuck Phillips) writes: >Agreed. In the spirit of C, the compiler _should_, by default, have the >freedom to rearrange an expression (take advantage of distributivity, etc.). >However, there are times when you _really need_ to explicitly control the >order and means of evaluation. Please describe such a circumstance. I believe that all such are covered by the new ANSI C rules%, and hence there is no need for extensions like your proposed "cast-to-volatile". Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint Followups to comp.lang.c only; this isn't really C++ related. ________ % Briefly, the rule is that the implementation is permitted to rearrange only through the grace of the as-if rule: i.e., only if the result obtained is indistinguishable from that of the abstract machine. Lvalues with the "volatile" attribute must be loaded and stored as per the abstract machine.