Comment
Comment by cratermoon
Author says that the following code is how to check for overflow:
But didn't the original problem arise because the compiler assumed overflow could never happen and simply optimized out the "undefined behavior"? What's to prevent compilers from optimizing out this check for similar reasons?