std::exit
From cppreference.com
| Defined in header <cstdlib>
|
||
| [[noreturn]] void exit( int exit_code );
|
(since C++11) | |
| void exit( int exit_code );
|
(until C++11) | |
Causes normal program termination to occur.
Several cleanup steps are performed:
- destructors of objects with thread local storage duration are called
- destructors of objects with static storage duration are called
- functions passed to std::atexit are called. If an exception tries to propagate out of any of the function, std::terminate is called
- all C streams are flushed and closed
- files created by std::tmpfile are removed
- control is returned to the host environment. If
exit_codeis EXIT_SUCCESS, an implementation-defined status, indicating successful termination is returned. Ifexit_codeis EXIT_FAILURE, an implementation-defined status, indicating unsuccessful termination is returned. In other cases implementation-defined status value is returned.
Destructors of variables with automatic storage durations are not called.
Contents |
[edit] Parameters
| exit_code | - | exit status of the program |
[edit] Return value
(none)
[edit] Example
| This section is incomplete Reason: no example |
[edit] See also
| causes abnormal program termination (without cleaning up) (function) |
|
| registers a function to be called on exit() invocation (function) |
|
| (C++11)
|
causes normal program termination without completely cleaning up (function) |