Program support utilities

Program termination

The following functions manage program termination and resource cleanup.

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

Communicating with the environment

calls the host environment's command processor
access to the list of environment variables


Several functions and macro constants for signal management are provided.

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

Non-local jumps

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


  • C11 standard (ISO/IEC 9899:2011):
    • 7.13 Nonlocal jumps <setjmp.h> (p: 262-264)
    • 7.14 Signal handling <signal.h> (p: 265-267)
    • 7.22 General utilities <stdlib.h> (p: 340-360)
    • 7.31.7 Signal handling <signal.h> (p: 455)
    • 7.31.12 General utilities <stdlib.h> (p: 456)
  • C99 standard (ISO/IEC 9899:1999):
    • 7.13 Nonlocal jumps <setjmp.h> (p: 243-245)
    • 7.14 Signal handling <signal.h> (p: 246-248)
    • 7.20 General utilities <stdlib.h> (p: 306-324)
    • 7.26.6 Signal handling <signal.h> (p: 401)
    • 7.26.10 General utilities <stdlib.h> (p: 402)
  • C89/C90 standard (ISO/IEC 9899:1990):
    • 4.6 NON-LOCAL JUMPS <setjmp.h>
    • 4.7 SIGNAL HANDLING <signal.h>
    • 4.10 GENERAL UTILITIES <stdlib.h>
    • 4.13.5 Signal handling <signal.h>
    • 7.13.7 General utilities <stdlib.h>

See also

C++ documentation for Program support utilities

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.