From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,d57b97ad32cb5f46 X-Google-Attributes: gid109fba,public X-Google-Thread: 10ba33,d57b97ad32cb5f46 X-Google-Attributes: gid10ba33,public X-Google-Thread: 11035d,d57b97ad32cb5f46 X-Google-Attributes: gid11035d,public X-Google-Thread: f678f,d57b97ad32cb5f46 X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,d57b97ad32cb5f46 X-Google-Attributes: gidfee84,public From: dHarrison@worldnet.att.net (Doug Harrison) Subject: Re: Strange thing about exceptions and destructors Date: 1997/05/12 Message-ID: <33788a96.12011281@netnews.worldnet.att.net>#1/1 X-Deja-AN: 241147965 Distribution: inet References: Organization: AT&T WorldNet Services Newsgroups: comp.lang.c++,comp.unix.osf.misc,comp.unix.osf.osf1,comp.unix.solaris,gnu.g++.help On 12 May 1997 20:39:57 +0200, Aleksandar Milivojevic wrote: >I would like to know when the destructor for thrown object is called. I >expected that it is called only one time (and not two or three times) >after the catch block is executed. So in order to check that, I wrote >a simple program and it gave me three different outputs when compiled >with Sun CC, DEC cxx and GNU g++ (last gave me internal compiler >error, but when I commented last line of main() it compiled OK). > >Now, Am I doing something totaly wrong, or that three compilers >generate incorect code (and which one generated correct code, if any)? Some suggestions: Add a copy-ctor that announces its invocation. Besides announcing their invocation, have your ctors and dtor print the object addresses. -- Doug Harrison dHarrison@worldnet.att.net