News for hackers. Stuff that matters.
Re:Efficient Integer Overflow Checking in LLVM by dbaupp on Saturday April 09, 2016 @09:03PM (#11464275)
You may be interested in http://blog.regehr.org/archives/1139 by the same author, and also the (GNU) compiler built-ins for exactly that task https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins... .

(Note that your second example can't work in C/C++, since the check happens after the operation.)

Re:Efficient Integer Overflow Checking in LLVM by daurnimator on Saturday April 09, 2016 @09:13PM (#11464309)
> (Note that your second example can't work in C/C++, since the check happens after the operation.)

I think the poster already knew that, hence the `magic`.