...
While this particular example benefits from calling exit()
over abort()
, there will be situations where abort()
is the better choice. Usually this will occur if one does not want to close any file descriptors or call any handlers registered with atexit()
, for instance, if the speed of terminating the program is critical.
For more details on proper usage of abort()
, see ERR06-C. Understand the termination behavior of assert() and abort().
Risk Analysis
Using abort()
or _Exit()
in place of exit()
may leave written files in an inconsistent state, and may also leave sensitive temporary files on the file system.
...