() ignored in some expressions

Karl Heuer karl at haddock.ima.isc.com
Tue Apr 10 05:31:49 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.

It can be argued that this was really a statement about a particular compiler
rather than a language feature.

>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.

Optimization.  With unsigned integers (and also signed integers in the usual
implementation), you get exactly the same answer anyway, so why not explicitly
allow it?

>Is this feature also present in ANSI standard C?

No.  The places where it's useful are already covered by the as-if rule.

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