When abort() is preferred over exit()?

前端 未结 4 1225
傲寒
傲寒 2021-02-02 10:42

I know the differences between the two. One notable thing is that abort() sends SIGABRT signal, so it may be relevant when your software relies on them. But for

4条回答
  •  面向向阳花
    2021-02-02 11:06

    Sometimes your program breaks to such extent that its state becomes inconsistent and so exit() will not work because it would cause global objects destruction and the latter would not function properly when the state is inconsistent. In such situations abort() is to be preferred.

提交回复
热议问题