4 ms·
Using gcc or g++ I get "1" not "0" for that expression, as I would intuitively expect. But this is undefined behavior in c/c++: tmp.c: In function ‘main’: tmp.
by sn 14y ago
Using gcc or g++ I get "1" not "0" for that expression, as I would intuitively expect. But this is undefined behavior in c/c++:
tmp.c: In function ‘main’:
tmp.c:3:5: warning: operation on ‘i’ may be undefined [-Wsequence-point]
- fragmede 14y agoEh? int main() { int i=0; return i += i++; } Returns 0, as expected.