| Program termination | |||||||||||||||||||||
| |||||||||||||||||||||
| Unreachable control flow | |||||||||||||||||||||
(C23) | |||||||||||||||||||||
| Communicating with the environment | |||||||||||||||||||||
| |||||||||||||||||||||
| Memory alignment query | |||||||||||||||||||||
(C23) | |||||||||||||||||||||
| Signals | |||||||||||||||||||||
| Signal types | |||||||||||||||||||||
| Non-local jumps | |||||||||||||||||||||
| Types | |||||||||||||||||||||
Defined in header <stdlib.h> | ||
void abort(void); | (until C11) | |
_Noreturnvoid abort(void); | (since C11) (until C23) | |
[[noreturn]]void abort(void); | (since C23) | |
Causes abnormal program termination unlessSIGABRT is being caught by a signal handler passed to signal and the handler does not return.
Functions passed toatexit() are not called. Whether open resources such as files are closed is implementation defined. An implementation defined status is returned to the host environment that indicates unsuccessful execution.
Contents |
(none)
(none)
POSIXspecifies that theabort() function overrides blocking or ignoring theSIGABRT signal.
Some compiler intrinsics, e.g.__builtin_trap (gcc, clang, and icc) or__fastfail/__debugbreak (msvc), can be used to terminate the program as fast as possible.
Output:
error opening file data.txt in function main()
| causes normal program termination with cleaning up (function)[edit] | |
| registers a function to be called onexit() invocation (function)[edit] | |
(C11) | causes normal program termination without completely cleaning up (function)[edit] |
C++ documentation forabort | |