This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49679] New: Increment/decrement operator (++/--) not working as expected
- From: "jordan_2000 at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 8 Jul 2011 17:52:27 +0000
- Subject: [Bug c++/49679] New: Increment/decrement operator (++/--) not working as expected
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: jordan_2000@hotmail.de
#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