warning: operation on 'zero' may be undefined

Andrew Pinski pinskia@physics.uc.edu
Fri Oct 1 15:41:00 GMT 2004


On Oct 1, 2004, at 10:18 AM, Paul Schlie wrote:

>   zero = ((zero = zero + 1) % 3) ;

That is still undefined at least according to the C and C++ standards.
We can take it to mean:
zero = zero + 1;
> zero = ((zero) % 3) ;
or
> old_zero = zero + 1;
> zero = ((old_zero) % 3); zero = old_zero;

So the assignment can come in any order unless you have a sequence point
in-between.

Now Java has different rules and acts the way you think it would, left 
to
right.

Thanks,
Andrew Pinski



More information about the Gcc mailing list