#include // compile with -Wall to get a warning for this code int main(int argc, char** argv) { int i = 0; int j; // undefined behavior. // C++ standard says you can not modify the value of a variable // more than once in a statement j = ++i + ++i; // this is undefined also because it is not defined whether // ++i increments i before or after it adds it self to the second i. // "the order in which side effects take place is unspecified" j = ++i + i; std::cout << j << std::endl; return 0; }