Integer overflows can be hidden inside your C++ code and can cause subtle nasty bugs.
Fortunately, it's easy to guard your code against those subtle bugs, thanks to an open-source easy-to-use library:
by Giovanni Dicanio
From the article:
In previous blog posts I discussed the problem of integer overflow and some subtle bugs that can be caused by that. (...)
Of course, writing this kind of complicated check code each time there is a sum operation that could potentially overflow would be excruciatingly cumbersome, and bug prone! (...)
Fortunately, you don’t have to do all that work! In fact, there is an open source library that does exactly that! This library is called SafeInt. (...)
The code will still look nice and simple, but safety checks will happen automatically under the hood. Thank you very much SafeInt and C++ operator overloading!