| ||
If you use gcc, you can compile with the -ftrapv option. This catches signed integer overflows by calling into various run-time functions, but it works only for signed integers. The other bit of bad news is these functions call abort() on overflow.
Microsoft Visual C++ 2005 automatically catches calls to operator new that overflow. Note, your code must catch the ensuing std::bad_alloc exception, or your application will crash.