atexit, #pragma exit, and Destructors
Go Up to Destructors Index
All global objects are active until the code in all exit procedures has executed. Local variables, including those declared in the main function, are destroyed as they go out of scope. The order of execution at the end of a program is as follows:
atexit()
functions are executed in the order they were inserted.- #pragma exit functions are executed in the order of their priority codes.
- Destructors for global variables are called.