home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13300 < prev    next >
Encoding:
Text File  |  1992-09-04  |  1.2 KB  |  37 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: Destructors and exit()
  5. Message-ID: <1992Sep4.160254.16993@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1992Sep3.220301.16983@murdoch.acc.Virginia.EDU>
  8. Date: Fri, 4 Sep 1992 16:02:54 GMT
  9. Lines: 26
  10.  
  11. rad2r@uvacs.cs.Virginia.EDU (Robert DeLine) writes:
  12.  
  13. >Sorry for this novice question, but when I call exit() from a program compiled
  14. >using g++ 2.1, the destructors for my objects don't get called.
  15.  
  16. ARM, p21:
  17. "Destructors for initialized static objects are called when returning
  18. from main() and when calling exit()."
  19.  
  20. Perhaps the bug is fixed in a later version of g++.
  21.  
  22.  
  23. >What if the program is ended due to an uncaught exception?
  24.  
  25. See the ARM, p 364-5.  You can set up your own handlers for
  26. unexpected and/or uncaught exceptions, but the default handling
  27. winds up calling abort(); abort() does not invoke static
  28. destructors.
  29.  
  30. If you have uncaught or unexpected exceptions, the default assumption
  31. is that things have gone so far wrong that attempting to clean up will
  32. only make things worse.
  33. -- 
  34.  
  35. Steve Clamage, TauMetric Corp, steve@taumet.com
  36. Vice Chair, ANSI C++ Committee, X3J16
  37.