This is the mail archive of the gcc-bugs@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]

[Bug c++/17507] Problems with shift and increment operator precedence


------- Additional Comments From work at paul dot dubuc dot org  2004-09-15 20:30 -------
(In reply to comment #6)
> As for question 1) The standard says that the result is undefined, i.e. 
> the compiler can do whatever it pleases. That includes doing one of 
> the increments, four in the same order in which the appear left to 
> right, four in the reverse order, etc. It isn't a bug, but an opportunity 
> the standard leaves to the compiler writers to implement optimizations.

Regardless of the order that the increment is done in this statement, I would
expect it to be done 4 times (not only once) by the time the statement ends.
 
>  
> As for 2) the result is still undefined, and the fact that you get what 
> you expect can be attributed to luck. 

I can accept this, I guess, if nothing in the Standard says the undefined
behavior must be consistent.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17507


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