Path: utzoo!mnetor!uunet!mcvax!inria!blueberry!shapiro From: shapiro@blueberry.inria.fr (Marc Shapiro) Newsgroups: comp.lang.c++ Subject: Re: Exception handling Message-ID: <627@inria.UUCP> Date: 4 Mar 88 08:33:50 GMT References: <3117@okstate.UUCP> <306@nih-csl.UUCP> Sender: news@inria.UUCP Organization: Institut National de Recherche en Informatique et Automatique, Rocquencourt, France Lines: 27 Summary: you can do exception handling in C++ In article <306@nih-csl.UUCP> keith@nih-csl.UUCP (keith gorlen) writes: >But don't get excited -- the real problem is that when an exception >occurs and you want to jump out to an enclosing exception frame, >there's no way to get the destructors of all the objects local to >blocks that are going out of scope called without help from the >compiler. Well, it can be fudged. We have a macro package for exceptions (thanks to Dima Abrossimov) which does the right thing. This is how it works: macro-expand a "raise exception" into "fudge the stack; return". Cfront sees the return and generates calls to destructors of local variables; however you have fudged the stack so that the return jumps into your exception handler instead of continuing in sequence. I'm not saying it's the right way. Proper compiler support is a much better idea. Marc Shapiro INRIA, B.P. 105, 78153 Le Chesnay Cedex, France. Tel.: +33 (1) 39-63-53-25 e-mail: shapiro@inria.inria.fr or: ...!mcvax!inria!shapiro Marc Shapiro INRIA, B.P. 105, 78153 Le Chesnay Cedex, France. Tel.: +33 (1) 39-63-53-25 e-mail: shapiro@inria.inria.fr or: ...!mcvax!inria!shapiro