I understand that integer underflow and overflow are undefined.
However, given that C++ eventually compiles to assembly, isnt the behavior actually defined?
The bitwise representation stays the same, the integer format remains the same 0111..11 will always roll over to 1000..00, same for underflows, so why is it not considered defined behaviour?
About the assembly compilation, I was deriving from the rudimentary assembly we were taught in school, but code blocks gives
int x = INT_MAX;
int y = x+1;
compiles to
00401326 movl $0x7fffffff,0x8(%esp)
0040132E mov 0x8(%esp),%eax
00401332 inc %eax
00401333 mov %eax,0xc(%esp)
Now, regardless of the value of x, wont there always be an inc or a add instruction? So, where does the undefined behaviour arise?