Possible Duplicate:
Will exit() or an exception prevent an end-of-scope destructor from being called?
In C++, when the application calls exit(3) are the destructors on the stack supposed to be run to unwind the stack?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, most destructors are not run on
exit().C++98 §18.3/8 discusses this.
Essentially, when
exitis called static objects are destroyed,atexithandlers are executed, open C streams are flushed and closed, and files created bytmpfileare removed. Local automatic objects are not destroyed. I.e., no stack unwinding.Calling
abortlets even less happen: no cleanup whatsoever.