+ 1
Undefined behaviour
when i compile int i = 0; i = i + i++; cout << i << endl ; via gcc and via clang-3.8 i get different results.
1 Resposta
+ 2
i think c/c++ language description has cases where the behaviour is not specified. in the example are rules like: evaluate from left to right, i++ increments i and returns the old value, + is commutative. but they are contradicting.
so i think you can not guarantee the behaviour! it is undefined -