From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!tsicnews.teliasonera.com!news.otenet.gr!news.grnet.gr!newsfd02.forthnet.gr!not-for-mail From: Ioannis Vranos Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Class hierarchy of exceptions (Ada, C++) Date: Mon, 28 Mar 2005 15:29:48 +0300 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <1112012988.13807@athnrd02> References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <1111607633.301232.62490@z14g2000cwz.googlegroups.com> <87oed6wvyx.fsf_-_@insalien.org> <1111876424.201726@athnrd02> <874qewvycq.fsf@insalien.org> <1112011700.94455@athnrd02> <87zmwoufk8.fsf@insalien.org> NNTP-Posting-Host: athnrd02.forthnet.gr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: athprx02.forthnet.gr 1112012988 22760 193.92.150.73 (28 Mar 2005 12:29:48 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Mon, 28 Mar 2005 12:29:48 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en In-Reply-To: <87zmwoufk8.fsf@insalien.org> Cache-Post-Path: newsfd02!unknown@ppp14-adsl-46.ath.forthnet.gr Xref: g2news1.google.com comp.lang.ada:10069 comp.lang.c++:47592 comp.realtime:1774 comp.software-eng:5408 Date: 2005-03-28T15:29:48+03:00 List-Id: Ludovic Brenta wrote: >>int main() try > > > ^ > Isn't there a missing { here? No. > > >>{ >> throw SomeException("Something is wrong!"); >>} >> >> >>catch(std::exception &e) >>{ >> std::cerr<>} > > > And a missing } here? In which case I don't see any propagation of > your exception up the stack, as there is only one stack frame. The code is ISO C++ compliant as it is. The exception on the stack works in whatever stack depth as far as the copy constructor is accessible (exists and is public). > Since you don't provide a copy constructor, only a shallow copy takes > place. Which is the copying of the pointer value. > Where is the message string allocated, and how do you know it > is still accessible when you catch the exception in a location remote > from the throw statement? The string literal exists in an implementation defined space and is guaranteed to be accessible as long as it gets accessed. > Also, copying the exception once for each stack frame seems quite > inefficient to me. I doubt that compiler writers would do that, > especially in the general case of C++ where the exception object can > be arbitrarily large. Yes the compiler writers are free and do optimise this. However the copy constructor is required to be accessible for those who do not optimise it. -- Ioannis Vranos http://www23.brinkster.com/noicys [I am using 90 characters word-wrapping - (800/640) *72= 90 or better described as: (800/640) *80 - 10 for quotation= 90. If someone finds it inconvenient, please let me know].