What is the difference between std::quick_exit and std::abort and why was std::quick_exit needed?

后端 未结 3 1852
借酒劲吻你
借酒劲吻你 2020-12-03 02:21

C++11 introduces a new way of finishing program execution—std::quick_exit.

Quoting the N3242 18.5 (p. 461):

[[noreturn]] vo         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-03 02:59

    The rationale for std::quick_exit is discussed in N1327 and N2440. The key differences between quick_exit, _Exit, and exit concerns the handling of static destructors and flushing critical information to stable storage:

    • std::_Exit: doesn't execute static destructors or flush critical IO.
    • std::exit: executes static destructors and flushes critical IO.
    • std::quick_exit: doesn't execute static destructors, but does flush critical IO.

    (As mentioned, std::abort just sends SIGABRT.)

提交回复
热议问题