Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Initialization

&pagelevel(4)&pagelevel

Exceptions thrown during the initialization of global objects result in a call to terminate and thus cause the program to abort without diagnostics. If desired, you can use set_terminate to specify some other exception-handling routine to be used in the event of an unforeseen program abort. This function must, however, be called before initializing the global objects.

The C++ runtime system offers the following solution to specify functions to be used as the “initial current handler”:

  • You can link your own __initial_terminate_handler function of type terminate_handler into your program. This function is declared weak in the C++ runtime system. If __initial_terminate_handler is defined, the function will then be called as the “initial handler” to terminate exception processing.

  • You can also use the functions __initial_unexpected_handler and __initial_new_handler with the same mechanism. These routines are of type unexpected_handler and new_handler, respectively.

You must include the header file <exception> for the __initial_terminate_handler and __initial_unexpected_handler interfaces and the header file <new> for the __initial_new_handler.