Short circuit evaluation/expression rearrangement (2nd summary)

Henry Spencer henry at zoo.toronto.edu
Tue Jun 4 08:22:14 AEST 1991


In article <andand.675959815 at cia.docs.uu.se> andand at cia.docs.uu.se (Anders Andersson) writes:
> [a + b + c]
>What you DO know:     The addition of a and b will be made before c is
>                       added to the result.

More precisely, what you know is that the program will *behave as if* things
were done that way.  In particular, if the compiler can be sure that the
order of evaluation will not affect behavior, it can use any order it pleases.
For example, if the implementation ignores integer overflows, the additions
in a+b+c+d can be done in any order.
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list