[Bug c/26923] byte swap incorrect

pluto at agmk dot net gcc-bugzilla@gcc.gnu.org
Wed Mar 29 18:51:00 GMT 2006



------- Comment #1 from pluto at agmk dot net  2006-03-29 18:51 -------
It's not a gcc bug. The code relies on the results of intermediate
subexpressions.  According to Stroustrup, The C++ Programming Language, section
6.2.2, "The order of evaluation of subexpressions within
an expression is undefined."

You should use sequence points e.g.:

        a ^= b, b ^= a, a ^= b;

This is a dup of PR11751


-- 


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



More information about the Gcc-bugs mailing list