Program support utilities

Program termination

The following functions manage program termination and resources cleanup.

Defined in header <stdlib.h>
abort
causes abnormal program termination (without cleaning up)
(function)
exit
causes normal program termination with cleaning up
(function)
quick_exit
(C11)
causes normal program termination without completely cleaning up
(function)
_Exit
(C99)
causes normal program termination without cleaning up
(function)
atexit
registers a function to be called on exit() invocation
(function)
at_quick_exit
(C11)
registers a function to be called on quick_exit invocation
(function)
EXIT_SUCCESSEXIT_FAILURE
indicates program execution execution status
(macro constant)

Unreachable control flow

Defined in header <stddef.h>
unreachable
(C23)
marks unreachable point of execution
(function macro)

Communicating with the environment

Defined in header <stdlib.h>
system
calls the host environment's command processor
(function)
getenvgetenv_s
(C11)
access to the list of environment variables
(function)

Signals

Several functions and macro constants for signal management are provided.

Defined in header <signal.h>
signal
sets a signal handler for particular signal
(function)
raise
runs the signal handler for particular signal
(function)
sig_atomic_t
the integer type that can be accessed as an atomic entity from an asynchronous signal handler
(typedef)
SIG_DFLSIG_IGN
defines signal handling strategies
(macro constant)
SIG_ERR
error was encountered
(macro constant)
Signal types
SIGABRTSIGFPESIGILLSIGINTSIGSEGVSIGTERM
defines signal types
(macro constant)

Non-local jumps

Defined in header <setjmp.h>
setjmp
saves the context
(function macro)
longjmp
jumps to specified location
(function)
Types
jmp_buf
execution context type
(typedef)

References

See also

C++ documentation for Program support utilities

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/c/program