() ignored in some expressions

diamond@tkovoa diamond at tkou02.enet.dec.com
Wed Apr 11 11:59:41 AEST 1990

In article <1272 at sdrc.UUCP> scjones at sdrc.UUCP (Larry Jones) writes:

>ANSI C requires that all expressions be evaluated as
>written.  Thus for "a + b + c" the compiler must add a and b
>first, then add c to the result.

No.  For "a + b + c", the compiler may add a + c, then add b to the
result, if it wishes, or if it generates faster code.

This whole discussion concerns whether () may be ignored.  In ANSI,
for "(a + b) + c", the () must be obeyed.  Now the compiler must
add a and b first, then add c, or else do something that has the
same exact behavior.

Norman Diamond, Nihon DEC     diamond at tkou02.enet.dec.com

More information about the Comp.lang.c mailing list