Short circuit evaluation/expression rearrangement (2nd summary)

Jonathan Gingerich jon at maui.cs.ucla.edu
Fri Jun 7 03:12:40 AEST 1991


In article <1991Jun5.231833.20542 at sq.sq.com> msb at sq.sq.com (Mark Brader) writes:
>Wow, I get to correct Henry Spencer.
>> > [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.
>
>Still more precisely, what you know is that *if* the program would *not*
>cause an exception (e.g. overflow) if things were done that way, *then*
>it will behave *as if* things were done that way.

No, Henry is correct.  How can you distinguish the evaluation of a rearranged
expression from an undefined evaluation which could be _anything_?

Jon.



More information about the Comp.lang.c mailing list