+noeh option.
CAUTION: If your executable throws no exceptions, object files compiled with and without the +noeh option can be mixed freely.
However, in an executable which throws exceptions (note that HP aC++ run-time libraries throw exceptions), you must be certain that no exception is thrown in your application which will unwind through a function compiled without the exception handling option turned on. In order to prevent this, the call graph for the program must never have calls from functions compiled without exception handling to functions compiled with exception handling (either direct calls or calls made through a callback mechanism). If such calls do exist, and an exception is thrown, the unwinding can cause:
The Standard C++ Library provides classes that C++ programs can use for reporting errors. These classes are defined in the header file <stdexcept> and described in the ANSI/ISO C++ International Standard.
exception is the base class for object types thrown by the
Standard C++ Library components and certain expressions.
runtime_error class defines errors due to events beyond
the scope of the program.
logic_error class defines errors in the internal logic of the program.
The simple program shown here illustrates exception handling concepts. This program:
A function can catch exceptions thrown during its execution by associating catch handlers with its body, using a function try block. Note the difference between the following example and the previous exception handling example. In this case, the try keyword comes before the function body's opening brace, and the catch handler comes after the function body's closing brace.
Function try blocks are sometimes necessary with class constructor destruction. A function try block is the only means of ensuring that all exceptions thrown during the construction of an object are caught within the constructor. For example:
Note that the function try block ensures the exception thrown from the member initializer is caught within the constructor.
HP aC++ exception handling has no significant performance impact at compile-time or run-time.