abort, terminate or exit?

后端 未结 6 575
心在旅途
心在旅途 2021-01-29 20:31

What\'s the difference between those three, and how shall I end program in case of exception which I can\'t handle properly?

6条回答
  •  情话喂你
    2021-01-29 20:48

    • terminate leaves you the possibility to register what will happen when it is called. Should be one of the other two.
    • exit is a normal exit allowing to specify an exit status. Handlers registered by at_exit() are run
    • abort is an abnormal exit. The only thing which is ran is the signal handler for SIGABRT.

提交回复
热议问题