[exception.terminate] (original) (raw)
17 Language support library [support]
17.9 Exception handling [support.exception]
17.9.4 Abnormal termination [exception.terminate]
17.9.4.1 Type terminate_handler [terminate.handler]
using terminate_handler = void (*)();
The type of ahandler functionto be called bystd::terminate() when terminating exception processing.
Required behavior:A terminate_handler shall terminate execution of the program without returning to the caller.
Default behavior:The implementation's default terminate_handler callsabort().
17.9.4.2 set_terminate [set.terminate]
terminate_handler set_terminate(terminate_handler f) noexcept;
Effects:Establishes the function designated by f as the current handler function for terminating exception processing.
Remarks:It is unspecified whether a null pointer value designates the defaultterminate_handler.
Returns:The previous terminate_handler.
17.9.4.3 get_terminate [get.terminate]
terminate_handler get_terminate() noexcept;
Returns:The current terminate_handler.
[ Note
:
This may be a null pointer value.
— end note
]
17.9.4.4 terminate [terminate]
[[noreturn]] void terminate() noexcept;
Remarks:Called by the implementation when exception handling must be abandoned for any of several reasons ([except.terminate]).
May also be called directly by the program.
Effects:Calls a terminate_handler function.
It is unspecified whichterminate_handler function will be called if an exception is active during a call to set_terminate.
Otherwise calls the current terminate_handler function.
[ Note
:
A default terminate_handler is always considered a callable handler in this context.
— end note
]