() ignored in some expressions

Checkpoint Technologies ckp at grebyn.com
Tue Apr 10 05:13:29 AEST 1990


In article <48079 at lanl.gov> u096000 at lanl.gov (Roger A. Cole) writes:
>In K&R1, expressions involving one of the associative and commutative
>operators can be arranged even when parenthesized.
>
>From the first time I read this, I've had difficulty not throwing up in
>instances where this applies.  I might be able to accept this *feature*
>a little more peacefully if someone could explain the basis for it.
>
>Is this feature also present in ANSI standard C?

This feature is modified in ANSI C.  It now states that the results of
expressions will be the answer as if parentheses had been honored.  The
compiler is still free to rearrange the expression, but only if the
actions taken are always guaranteed to get the exact same answer in all
cases as if the parentheses had been honored.  In most cases this means
that yes, the compiler will actually perform the operations in the order
specified by the parentheses.  This does not apply to side effects;
their order is still undefined.



More information about the Comp.lang.c mailing list