Re:Catching Integer Overflows in C
by haberman on Tuesday August 02, 2011 @01:44PM
(#2837981)
I'm glad that this is corrected later on, but that contradicts the statements made at the beginning of the article:
> So, if you want to add two integers a and b (b >= 0), the easiest way to find out if that overflows is to check whether a+b<a (or b; some people think you have to check against min(a,b), but that is unnecessary).
This statement is untrue, as is the other statement I quoted.
> So, if you want to add two integers a and b (b >= 0), the easiest way to find out if that overflows is to check whether a+b<a (or b; some people think you have to check against min(a,b), but that is unnecessary).
This statement is untrue, as is the other statement I quoted.