Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!pacbell!well!nagle From: nagle@well.UUCP (John Nagle) Newsgroups: comp.lang.c++ Subject: Re: Handling trouble in C++ Keywords: exception error Message-ID: <13354@well.UUCP> Date: 26 Aug 89 19:01:52 GMT References: <13262@well.UUCP> <24F42DB0.D08@marob.masa.com> <13789@polyslo.CalPoly.EDU> Reply-To: nagle@well.UUCP (John Nagle) Distribution: usa Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 26 In article <13789@polyslo.CalPoly.EDU> ttwang@polyslo.CalPoly.EDU (Thomas Wang) writes: >cowan@marob.masa.com (John Cowan) writes: > >I would suggest to do a check on the failure variable after >every function call, and if a failure has occurred then goto the local >failure handling label. There is always a local failure handling label, >even if the code at the label only calls some destructors, then returns >to the caller. No good. What if failure is detected within a declaration, and only some of the objects associated with that block have been created at that point? The "local failure handling label" concept can't handle this, lacking information about exactly which constructors have been properly instantiated. An even worse case comes when a constructor of a base class fails while construction of a derived class is underway. Imagine instantiating "menu" and having "window" fail at a lower level because too many windows are open. When thinking about how to do this, it's worth remembering the design criterion for the exception handling mechanism in Ada that the overhead for the case in which no exceptions occur must be minimized, even if this makes exception handling slow. John Nagle