Using distributive property to optimize.

Chuck Phillips chuckp at ncr-fc.FtCollins.NCR.com
Wed Feb 14 00:56:34 AEST 1990


On 7 Feb 90 20:25:41 GMT,
karl at 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



More information about the Comp.lang.c mailing list