Go to main content
Oracle® Developer Studio 12.6: C++ User's Guide

Exit Print View

Updated: July 2017
 
 

8.2 Specifying Runtime Errors

Five runtime error messages are associated with exceptions:

  • No handler for the exception

  • Unexpected exception thrown

  • An exception can only be re-thrown in a handler

  • During stack unwinding, a destructor must handle its own exception

  • Out of memory

When errors are detected at runtime, the error message displays the type of the current exception and one of the five error messages. By default, the predefined function terminate() is called, which then calls abort().

The compiler uses the information provided in the exception specification to optimize code production. For example, table entries for functions that do not throw exceptions are suppressed, and runtime checking for exception specifications of functions is eliminated wherever possible.