Namespaces
Variants
Views
Actions

Difference between revisions of "c/program"

From cppreference.com
< c
m (References)
(+ memalignment, C23 refs)
 
(7 intermediate revisions by 4 users not shown)
Line 3: Line 3:
  
 
===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 begin}}
Line 17: Line 16:
 
{{dsc end}}
 
{{dsc end}}
  
===Communicating with the environment===
+
===Unreachable control flow===
 +
{{dsc begin}}
 +
{{dsc header | stddef.h}}
 +
{{dsc inc | c/program/dsc unreachable}}
 +
{{dsc end}}
  
 +
===Communicating with the environment===
 
{{dsc begin}}
 
{{dsc begin}}
 +
{{dsc header | stdlib.h}}
 
{{dsc inc | c/program/dsc system}}
 
{{dsc inc | c/program/dsc system}}
 
{{dsc inc | c/program/dsc getenv}}
 
{{dsc inc | c/program/dsc getenv}}
 
{{dsc end}}
 
{{dsc end}}
  
===Signals===
+
===Memory alignment query===
 +
{{dsc begin}}
 +
{{dsc header | stdlib.h}}
 +
{{dsc inc | c/program/dsc memalignment}}
 +
{{dsc end}}
  
 +
===Signals===
 
Several functions and macro constants for signal management are provided.
 
Several functions and macro constants for signal management are provided.
  
Line 41: Line 51:
  
 
===Non-local jumps===
 
===Non-local jumps===
 
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc header | setjmp.h}}
 
{{dsc header | setjmp.h}}
Line 52: Line 61:
  
 
===References===
 
===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 c11}}
 
{{ref std | section=7.13 | title=Nonlocal jumps <setjmp.h> | p=262-264}}
 
{{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.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.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 c99}}
 
{{ref std | section=7.13 | title=Nonlocal jumps <setjmp.h> | p=243-245}}
 
{{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.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.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 c89}}
{{ref std | section= | title=}}
+
{{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}}
 
{{ref std end}}
  
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc see cpp | cpp/utility/program |Program support utilities}}
+
{{dsc see cpp | cpp/utility/program |Program support utilities | nomono=true}}
 
{{dsc end}}
 
{{dsc end}}
  
[[de:c/program]]
+
{{langlinks|ar|cs|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}
[[es:c/program]]
+
[[fr:c/program]]
+
[[it:c/program]]
+
[[ja:c/program]]
+
[[pt:c/program]]
+
[[ru:c/program]]
+
[[zh:c/program]]
+

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