Skip to content

Search topics & cppreference

Search all study topics, concept maps, and 6,587 C++ and C reference pages.

std::terminate_handler

std::terminate_handler is the function pointer type (pointer to function that takes no arguments and returns void), which is installed and queried by the functions std::set_terminate and std::get_terminate and called by std::terminate.

NotebookLM
Defined in header <exception>
typedef void ( *terminate_handler )();

std::terminate_handler is the function pointer type (pointer to function that takes no arguments and returns void), which is installed and queried by the functions std::set_terminate and std::get_terminate and called by std::terminate.

A std::terminate_handler shall terminate execution of the program without returning to the caller, otherwise the behavior is undefined.

The C++ implementation provides a default std::terminate_handler function, which calls std::abort(). If the null pointer value is installed (by means of std::set_terminate), the implementation may restore the default handler instead.

Example

This section is incomplete
Reason: no example

See also

function called when exception handling fails
(function)
changes the function to be called by std::terminate
(function)
obtains the current terminate_handler
(function)

Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.