4

Possible Duplicate:
Best way to detect integer overflow in C/C++

I'm writing code where I may run into a situation where an overflow may occur as a multiplication of two integers. As far as I tested, no exception is thrown anywhere.

I am using Visual Studio 2010 and I've looked at the C++ compiler options to check overflow but there's nothing about it. I have all the optimizations off, but still not getting an error while performing multiplication (which DOES result in overflow). I can't change some critical parts of my code, and I need a way to detect overflow, I know hardware will raise an exception in the case of an exception, but couln't get it working.

Community
  • 1
  • 1
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • 3
    I am pretty sure that whoever told you that integer overflow raises an exception on x86 hardware was wrong. – NPE Dec 13 '11 at 21:48
  • 5
    Have you seen this? http://stackoverflow.com/questions/199333/best-way-to-detect-integer-overflow-in-c-c – kol Dec 13 '11 at 21:49

0 Answers0