This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warning: operation on 'zero' may be undefined



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]