C++11 introduces a new way of finishing program execution—std::quick_exit
.
Quoting the N3242 18.5 (p. 461):
[[noreturn]] void quick_exit(int status) noexcept;
Effects: Functions registered by calls to
at_quick_exit
are called in the reverse order of their registration, except that a function shall be called after any previously registered functions that had already been called at the time it was registered. Objects shall not be destroyed as a result of callingquick_exit
. If control leaves a registered function called byquick_exit
because the function does not provide a handler for a thrown exception,terminate()
shall be called. [ Note:at_quick_exit
may call a registered function from a different thread than the one that registered it, so registered functions should not rely on the identity of objects with thread storage duration. — end note ] After calling registered functions,quick_exit
shall call_Exit(status)
. [ Note: The standard file buffers are not flushed. See: ISO C 7.20.4.4. — end note ]
As the definition of std::abort(void)
and std::_Exit(int status)
differ only in ability to pass the status to the parent process, it raises my question.
Does it mean that the only difference in semantics between std::quick_exit
and std::abort
are that std::quick_exit
calls functions registered using std::at_quick_exit
and allows to set the returned status?
What was the rationale for introducing this function?