() ignored in some expressions

Henry Spencer henry at utzoo.uucp
Sun Apr 15 09:57:14 AEST 1990


In article <2575 at rwthinf.UUCP> berg at cip-s02.informatik.rwth-aachen.de (SRB) writes:
>Correct me if I'm wrong, but I thought that if you write it simply as
>"(a + b) + c" then the compiler may still ignore the ().
>But ANSI states: if you write it as "+(a + b) + c" (note the unary plus),
>then the compiler has to evaluate (a+b) first.

You've been confused by a very obsolete draft of ANSI C.  At one point,
this was the case -- the unary plus was the "enforce parentheses" operator,
more or less.  That idea was eventually discarded in favor of a general
"evaluation as written, subject to `as if' optimization" rule.
-- 
With features like this,      |     Henry Spencer at U of Toronto Zoology
who needs bugs?               | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list