warning: operation on 'zero' may be undefined

Paul Schlie schlie@comcast.net
Fri Oct 1 18:52:00 GMT 2004


Yes, fully agree; and since the expression's value is insensitive to the
order of evaluation of it's sub-expression arguments, it's unambiguous;
just as i = ++i is unambiguous, as it's sub expression argument values
are not interdependent.

The lhs computes the an lvalue, which is independent of it's referenced
content rvalue; just as the lvalue of x is independent of the rvalues of
a, b, or c, which are in turn have values which are independent of each
other's evaluated rvalues.

-paul-

Dave Korn wrote:
> Ah, but precedence != order of evalation.  Consider:
>
>     x = a * b + c;
>
> The precedence rules say that * has precedence over +; that means, that
> the formula is equivalent to (a*b) + c, but not equal to a * (b+c).
>
> However the compiler is still completely free as to whether it first
> evaluates a*b, and then adds c, or whether it first evaluates c, and then
> adds a*b.



More information about the Gcc mailing list