Using distributive property to optimize.

Karl Heuer karl at haddock.ima.isc.com
Thu Feb 15 09:02:26 AEST 1990


In article <CHUCKP.90Feb13065634 at halley.ncr-fc.FtCollins.NCR.com> chuckp at 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 at 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.



More information about the Comp.lang.c mailing list