Training
×

C++ Exception Handling

The C++ language has its own standard for exception handling, which resembles SEH but is not the same. It is based on defining a class for an exception, where several classes are based on a common class; for example, the class ‘exception’ is the base class for all C++ exceptions. You could use it as follows:
try {
   // some code here
}
catch (invalid_argument e) {
   // deal with ‘invalid argument’ exception
}
catch (exception e) {
   // deal with other C++ exceptions
}
catch (…) {
   // deal with all others
}
 
Use compiler switch “/fp:except” to enable floating point exceptions.