Difference between revisions of "cpp/error/terminate"
(+) |
m (note that default is abort()) |
||
Line 31: | Line 31: | ||
− | In any case, {{tt|std::terminate}} calls the currently installed {{cpp|std::terminate_handler}}. | + | In any case, {{tt|std::terminate}} calls the currently installed {{cpp|std::terminate_handler}}. The default {{cpp|std::terminate_handler}} calls {{cpp|std::abort}}. |
Revision as of 18:51, 27 March 2012
Defined in header <exception>
|
||
[[noreturn]] void terminate(); |
||
std::terminate()
is called by the C++ runtime when exception handling fails for any of the following reasons:
1) an exception is thrown and not caught (it is implementation-defined whether any stack unwinding is done in this case)
2) an exception is thrown during exception handling (e.g. from a destructor of some local object, or from a function that had to be called during exception handling)
3) the constructor or the destructor of a static or thread-local object throws an exception
4) a function registered with Template:cpp or Template:cpp throws an exception
5) a noexcept specification is violated (it is implementation-defined whether any stack unwinding is done in this case)
6) a dynamic exception specification is violated and the default handler for Template:cpp is executed
7) a non-default handler for Template:cpp throws an exception that violates the previously violated dynamic exception specification, if the specification does not include Template:cpp
8) Template:cpp is called for an object that isn't holding a captured exception
9) an exception is thrown from the initial function of Template:cpp
10) a joinable Template:cpp is destroyed or copy-assigned to
std::terminate()
may also be called directly from the program.
In any case, std::terminate
calls the currently installed Template:cpp. The default Template:cpp calls Template:cpp.
Contents |
Parameters
(none)
Return value
(none)