This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47412] Output: x = 31 but y = 30
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 22 Jan 2011 17:31:55 +0000
- Subject: [Bug c++/47412] Output: x = 31 but y = 30
- Auto-submitted: auto-generated
- References: <bug-47412-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47412
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-01-22 17:31:03 UTC ---
(In reply to comment #2)
> It seems interesting for me. It means Java doesn't assume it as an undefined
> behavior point or at least Java's compiler does in a unique way and doesn't
> care about being X or Y.
> Can anyone explain it?
Java is a different language with different rules about evaluation of
expressions. That code is well-defined in Java, but not C or C++
http://sgaur.wordpress.com/2009/03/30/java-evalorder-ops/
http://stackoverflow.com/questions/2028464/logic-differences-in-c-and-java/