...
Integer overflow is undefined behavior, so a compiled program can do anything, including going off to play the Game of Life. Furthermore, a compiler may perform optimizations that assume an overflow will never occur, which could can easily yield unexpected results. Compilers can optimize away if
statements that check if an overflow occured. See MSC15-A. Do not depend on undefined behavior for an example.
...