The contents are the same as the Standard C library header <stdlib.h>
with the following changes:
atexit(void (*f)(void))
The function atexit(), has additional behavior in C++:
For the execution of a function registered with atexit, if control
leaves the function because it provides no handler for a thrown
exception, terminate() is called.
exit(int status)
The function exit() has additional behavior in C++:
First, objects with static storage duration are destroyed and functions
registered by calling atexit are called. Objects with static
storage duration are destroyed in the reverse order of the completion
of their constructor. (Automatic objects are not destroyed as
a result of calling exit().) Functions registered
with atexit are
called in the reverse order of their registration. A function
registered with atexit before an object obj1 of static
storage duration
is initialized will not be called until obj1's destruction has
completed. A function registered with atexit
after an object obj2
of static storage duration is initialized will be called before
obj2's destruction starts.
Next, all open C streams (as mediated by the function signatures
declared in <cstdio>) with unwritten buffered data are flushed, all
open C streams are closed, and all files created by calling
tmpfile() are removed.
Finally, control is returned to the host environment. If status is
zero or EXIT_SUCCESS, the status
``successful termination'' is returned. If status
is EXIT_FAILURE,
the status ``unsuccessful termination''
is returned.