Namespaces
Variants
Views
Actions

Difference between revisions of "c/program"

From cppreference.com
< c
(Created page with "{{title|Program support utilities}} {{c/program/sidebar}} ===Program termination=== The following functions manage program termination and resource cleanup. {{dcl list begin}}...")
 
(+ memalignment, C23 refs)
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{title|Program support utilities}}
 
{{title|Program support utilities}}
{{c/program/sidebar}}
+
{{c/program/navbar}}
  
 
===Program termination===
 
===Program termination===
 +
The following functions manage program termination and resources cleanup.
  
The following functions manage program termination and resource cleanup.
+
{{dsc begin}}
 +
{{dsc header | stdlib.h}}
 +
{{dsc inc | c/program/dsc abort}}
 +
{{dsc inc | c/program/dsc exit}}
 +
{{dsc inc | c/program/dsc quick_exit}}
 +
{{dsc inc | c/program/dsc _Exit}}
 +
{{dsc inc | c/program/dsc atexit}}
 +
{{dsc inc | c/program/dsc at_quick_exit}}
 +
{{dsc inc | c/program/dsc EXIT_status}}
 +
{{dsc end}}
  
{{dcl list begin}}
+
===Unreachable control flow===
{{dcl list header | stdlib.h}}
+
{{dsc begin}}
{{dcl list template | c/program/dcl list abort}}
+
{{dsc header | stddef.h}}
{{dcl list template | c/program/dcl list exit}}
+
{{dsc inc | c/program/dsc unreachable}}
{{dcl list template | c/program/dcl list quick_exit}}
+
{{dsc end}}
{{dcl list template | c/program/dcl list _Exit}}
+
{{dcl list template | c/program/dcl list atexit}}
+
{{dcl list template | c/program/dcl list at_quick_exit}}
+
{{dcl list template | c/program/dcl list EXIT_status}}
+
{{dcl list end}}
+
  
 
===Communicating with the environment===
 
===Communicating with the environment===
 +
{{dsc begin}}
 +
{{dsc header | stdlib.h}}
 +
{{dsc inc | c/program/dsc system}}
 +
{{dsc inc | c/program/dsc getenv}}
 +
{{dsc end}}
  
{{dcl list begin}}
+
===Memory alignment query===
{{dcl list template | c/program/dcl list system}}
+
{{dsc begin}}
{{dcl list template | c/program/dcl list getenv}}
+
{{dsc header | stdlib.h}}
{{dcl list end}}
+
{{dsc inc | c/program/dsc memalignment}}
 +
{{dsc end}}
  
 
===Signals===
 
===Signals===
 
 
Several functions and macro constants for signal management are provided.
 
Several functions and macro constants for signal management are provided.
  
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list header | signal.h}}
+
{{dsc header | signal.h}}
{{dcl list template | c/program/dcl list signal}}
+
{{dsc inc | c/program/dsc signal}}
{{dcl list template | c/program/dcl list raise}}
+
{{dsc inc | c/program/dsc raise}}
{{dcl list typedef | c/program/sig_atomic_t | the integer type that can be accessed as an atomic entity from an asynchronous signal handler}}
+
{{dsc typedef | c/program/sig_atomic_t | the integer type that can be accessed as an atomic entity from an asynchronous signal handler}}
{{dcl list template | c/program/dcl list SIG_strategies}}
+
{{dsc inc | c/program/dsc SIG_strategies}}
{{dcl list template | c/program/dcl list SIG_ERR}}
+
{{dsc inc | c/program/dsc SIG_ERR}}
  
{{dcl list h2 | Signal types}}
+
{{dsc h2 | Signal types}}
{{dcl list template | c/program/dcl list SIGABRT}}
+
{{dsc inc | c/program/dsc SIG_types}}
{{dcl list template | c/program/dcl list SIGFPE}}
+
{{dsc end}}
{{dcl list template | c/program/dcl list SIGILL}}
+
{{dcl list template | c/program/dcl list SIGINT}}
+
{{dcl list template | c/program/dcl list SIGSEGV}}
+
{{dcl list template | c/program/dcl list SIGTERM}}
+
{{dcl list end}}
+
  
 
===Non-local jumps===
 
===Non-local jumps===
 +
{{dsc begin}}
 +
{{dsc header | setjmp.h}}
 +
{{dsc inc | c/program/dsc setjmp}}
 +
{{dsc inc | c/program/dsc longjmp}}
 +
 +
{{dsc h2 | Types}}
 +
{{dsc inc | c/program/dsc jmp_buf}}
 +
{{dsc end}}
 +
 +
===References===
 +
{{ref std c23}}
 +
{{ref std | section=7.13 | title=Non-local jumps <setjmp.h> | p=283-284}}
 +
{{ref std | section=7.14 | title=Signal handling <signal.h> | p=285-287}}
 +
{{ref std | section=7.24 | title=General utilities <stdlib.h> | p=356-374}}
 +
{{ref std | section=7.33.9  | title=Signal handling <signal.h> | p=458}}
 +
{{ref std | section=7.33.16 | title=General utilities <stdlib.h> | p=458}}
 +
{{ref std end}}
 +
{{ref std c17}}
 +
{{ref std | section=7.13 | title=Nonlocal jumps <setjmp.h> | p=191-192}}
 +
{{ref std | section=7.14 | title=Signal handling <signal.h> | p=193-195}}
 +
{{ref std | section=7.22 | title=General utilities <stdlib.h> | p=248-262}}
 +
{{ref std | section=7.31.7  | title=Signal handling <signal.h> | p=332}}
 +
{{ref std | section=7.31.12 | title=General utilities <stdlib.h> | p=333}}
 +
{{ref std end}}
 +
{{ref std c11}}
 +
{{ref std | section=7.13 | title=Nonlocal jumps <setjmp.h> | p=262-264}}
 +
{{ref std | section=7.14 | title=Signal handling <signal.h> | p=265-267}}
 +
{{ref std | section=7.22 | title=General utilities <stdlib.h> | p=340-360}}
 +
{{ref std | section=7.31.7  | title=Signal handling <signal.h> | p=455}}
 +
{{ref std | section=7.31.12 | title=General utilities <stdlib.h> | p=456}}
 +
{{ref std end}}
 +
{{ref std c99}}
 +
{{ref std | section=7.13 | title=Nonlocal jumps <setjmp.h> | p=243-245}}
 +
{{ref std | section=7.14 | title=Signal handling <signal.h> | p=246-248}}
 +
{{ref std | section=7.20 | title=General utilities <stdlib.h> | p=306-324}}
 +
{{ref std | section=7.26.6  | title=Signal handling <signal.h> | p=401}}
 +
{{ref std | section=7.26.10 | title=General utilities <stdlib.h> | p=402}}
 +
{{ref std end}}
 +
{{ref std c89}}
 +
{{ref std | section=4.6  | title=NON-LOCAL JUMPS <setjmp.h>}}
 +
{{ref std | section=4.7  | title=SIGNAL HANDLING <signal.h>}}
 +
{{ref std | section=4.10 | title=GENERAL UTILITIES <stdlib.h>}}
 +
{{ref std | section=4.13.5 | title=Signal handling <signal.h>}}
 +
{{ref std | section=7.13.7 | title=General utilities <stdlib.h>}}
 +
{{ref std end}}
  
{{dcl list begin}}
+
===See also===
{{dcl list header | setjmp.h}}
+
{{dsc begin}}
{{dcl list template | c/program/dcl list setjmp}}
+
{{dsc see cpp | cpp/utility/program |Program support utilities | nomono=true}}
{{dcl list template | c/program/dcl list longjmp}}
+
{{dsc end}}
  
{{dcl list h2 | Types}}
+
{{langlinks|ar|cs|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}
{{dcl list template | c/program/dcl list jmp_buf}}
+
{{dcl list end}}
+

Latest revision as of 02:10, 10 October 2024

Contents

[edit] Program termination

The following functions manage program termination and resources cleanup.

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

[edit] Unreachable control flow

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

[edit] Communicating with the environment

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

[edit] Memory alignment query

Defined in header <stdlib.h>
queries the alignment of a pointer value
(function) [edit]

[edit] Signals

Several functions and macro constants for signal management are provided.

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

[edit] Non-local jumps

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

[edit] References

  • C23 standard (ISO/IEC 9899:2024):
  • 7.13 Non-local jumps <setjmp.h> (p: 283-284)
  • 7.14 Signal handling <signal.h> (p: 285-287)
  • 7.24 General utilities <stdlib.h> (p: 356-374)
  • 7.33.9 Signal handling <signal.h> (p: 458)
  • 7.33.16 General utilities <stdlib.h> (p: 458)
  • C17 standard (ISO/IEC 9899:2018):
  • 7.13 Nonlocal jumps <setjmp.h> (p: 191-192)
  • 7.14 Signal handling <signal.h> (p: 193-195)
  • 7.22 General utilities <stdlib.h> (p: 248-262)
  • 7.31.7 Signal handling <signal.h> (p: 332)
  • 7.31.12 General utilities <stdlib.h> (p: 333)
  • 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>

[edit] See also

C++ documentation for Program support utilities