() ignored in some expressions

Karl Heuer karl at haddock.ima.isc.com
Thu Apr 12 03:03:44 AEST 1990


In article <1458 at tkou02.enet.dec.com> diamond at tkou02.enet.dec.com (diamond at tkovoa) writes:
>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

No, since `+' associates left to right, `a+b+c' and `(a+b)+c' are equivalent.
It's a common myth that parens apply some type of magic binding, but all they
do is specify the parse tree.

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list