[Bug c++/49679] Increment/decrement operator (++/--) not working as expected

2011-07-08 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49679 --- Comment #4 from Jonathan Wakely 2011-07-08 18:37:41 UTC --- (In reply to comment #3) > a and b must be the same. No, it's undefined behaviour. Anything can happen. http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html

[Bug c++/49679] Increment/decrement operator (++/--) not working as expected

2011-07-08 Thread jordan_2000 at hotmail dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49679 --- Comment #3 from Jordan 2011-07-08 18:32:55 UTC --- I know the warnings, but look the code a+=++a+a++; b+=++b+b++; cout << "a=" << a << endl << "b=" << b << endl; cin >> a; a and b must be the same. if i re

[Bug c++/49679] Increment/decrement operator (++/--) not working as expected

2011-07-08 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49679 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|

[Bug c++/49679] Increment/decrement operator (++/--) not working as expected

2011-07-08 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49679 --- Comment #1 from Andrew Pinski 2011-07-08 17:55:35 UTC --- You are invoking undefined behavior because C++ does not specify what order of the operands happen first.