Standard C++ Library Reference ISO/IEC (VERSION3)
that have static duration. It also opens three standard streams, controlled by the text-stream
objects designated by the macros:
stdin -- for standard input●
stdout -- for standard output●
stderr -- for standard error output●
If main returns to its caller, the target environment calls exit with the value returned from
main as the status argument to exit. If the return statement that the program executes has no
expression, the status argument is undefined. This is the case if the program executes the
implied return statement at the end of the function definition.
You can also call exit directly from any expression within the program. In both cases, exit
calls all functions registered with atexit in reverse order of registry and then begins
program termination. At program termination, the target environment closes all open files,
removes any temporary files that you created by calling tmpfile, and then returns control to
the invoker, using the status argument value to determine the termination status to report for the
program.
The program can terminate abnormally by calling abort, for example. Each implementation
defines whether it closes files, whether it removes temporary files, and what termination status
it reports when a program terminates abnormally.
See also the Table of Contents and the Index.
Copyright © 1989-2001 by P.J. Plauger and Jim Brodie. All rights reserved.