http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49679
Summary: Increment/decrement operator (++/--) not working as
expected
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a=2;
int b=2;
a+=++a+a++;
b+=++b+b++;
cout << "a=" << a << endl << "b=" << b << endl;
cin >> a;
return EXIT_SUCCESS;
}
result
a=4
b=10