home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: Destructors and exit()
- Message-ID: <1992Sep4.160254.16993@taumet.com>
- Organization: TauMetric Corporation
- References: <1992Sep3.220301.16983@murdoch.acc.Virginia.EDU>
- Date: Fri, 4 Sep 1992 16:02:54 GMT
- Lines: 26
-
- rad2r@uvacs.cs.Virginia.EDU (Robert DeLine) writes:
-
- >Sorry for this novice question, but when I call exit() from a program compiled
- >using g++ 2.1, the destructors for my objects don't get called.
-
- ARM, p21:
- "Destructors for initialized static objects are called when returning
- from main() and when calling exit()."
-
- Perhaps the bug is fixed in a later version of g++.
-
-
- >What if the program is ended due to an uncaught exception?
-
- See the ARM, p 364-5. You can set up your own handlers for
- unexpected and/or uncaught exceptions, but the default handling
- winds up calling abort(); abort() does not invoke static
- destructors.
-
- If you have uncaught or unexpected exceptions, the default assumption
- is that things have gone so far wrong that attempting to clean up will
- only make things worse.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-