On 13/06/2017 12:42, Emil Dotchevski wrote:
WARNING If unhandled errors remain at the time the current thread terminates, Noexcept calls abort(). Use catch_<> to handle any error regardless of its type.
Shouldn't it call std::terminate() instead?
I think abort() is better because it would be strange for a program that doesn't use exceptions to indicate an unhandled exception. :) But maybe it would be more practical to call terminate(), I'm not sure.
std::terminate() isn't just for unhandled exceptions, though (eg. it's also called for unjoined threads). And this still kind of is an unhandled exception anyway. Using std::terminate() allows hooking std::set_terminate() to trigger logging or minidump/coredump, which can be useful. (abort() can be similarly intercepted via SIGABRT, but it's a more restricted context.) Or to put it another way: std::terminate() is C++; abort() is C. It seems wrong to use the C-based termination method in a C++ context.