std::exit

From Cppreference

Jump to: navigation, search
Defined in header <cstdlib>

void exit( int exit_code );

Causes normal program termination to occur.

Several cleanup steps are performed:

Causes abnormal program termination unless SIGABRT is being caught by a signal handler passed to signal and the handler does not return.

Destructors of variables with automatic, thread local and static storage durations are not called. Functions, passed to atexit() are also not called. Whether open resources such as files are closed is implementation defined. Implementation defined status is returned to the host environment that indicates unsuccessful execution.

Contents

[edit] Parameters

exit_code - exit status of the program

[edit] Return value

(none)

[edit] Example

[edit] See also

abort
causes abnormal program termination (without cleaning up)
(function)
atexit
registers a function to be called on exit() invocation
(function)
quick_exit (C++11)
causes normal program termination without completely cleaning up
(function)