Difference between revisions of "cpp/utility/program/atexit"
From cppreference.com
m (Text replace - "<!-- ======== --> " to "") |
m (+both overloads +noexcept) |
||
Line 2: | Line 2: | ||
{{cpp/utility/program/sidebar}} | {{cpp/utility/program/sidebar}} | ||
{{ddcl | header=cstdlib | | {{ddcl | header=cstdlib | | ||
− | int atexit( void (*func)() ); | + | extern "C" int atexit( void (*func)() ); |
+ | extern "C++" int atexit( void (*func)() ); | ||
}} | }} | ||
Line 16: | Line 17: | ||
===Return value=== | ===Return value=== | ||
{{cpp|0}} if the registration succeeds, nonzero value otherwise. | {{cpp|0}} if the registration succeeds, nonzero value otherwise. | ||
+ | |||
+ | ===Exceptions=== | ||
+ | {{noexcept}} | ||
===Example=== | ===Example=== |
Revision as of 19:56, 2 November 2011
Template:cpp/utility/program/sidebar
Defined in header <cstdlib>
|
||
extern "C" int atexit( void (*func)() ); extern "C++" int atexit( void (*func)() ); |
||
Registers the function pointed to by func
to be called on normal program termination (via exit()
or returning from main()
).
Calling the function from several threads does not induce a data race. The implementation shall support the registration of at least Template:cpp functions.
Contents |
Parameters
func | - | pointer to a function to be called on normal program termination |
Return value
Template:cpp if the registration succeeds, nonzero value otherwise.
Exceptions
noexcept specification:
noexcept
Example
See also
(C++11) |
registers a function to be called on std::quick_exit invocation (function) |