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!newsfeed00.sul.t-online.de!t-online.de!irazu.switch.ch!switch.ch!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:08:19 +0300 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <1112011700.94455@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> 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 1112011700 21875 193.92.150.73 (28 Mar 2005 12:08:20 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Mon, 28 Mar 2005 12:08:20 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en In-Reply-To: <874qewvycq.fsf@insalien.org> Cache-Post-Path: newsfd02!unknown@ppp14-adsl-46.ath.forthnet.gr Xref: g2news1.google.com comp.lang.ada:10066 comp.lang.c++:47583 comp.realtime:1771 comp.software-eng:5405 Date: 2005-03-28T15:08:19+03:00 List-Id: Ludovic Brenta wrote: > But my point was not just about being helped; it was also about the > mathematical purity of the concept of exceptions. If an exception can > be anything at all, then what is so exceptional about it? As a means of error handling. > Pascal Obry once made an interesting remark: what is important for the > safety of a language is not what it allows but what it forbids. You can't protect a bad programmer from doing bad programming, unless you forbid him to continue programming. :-) > Ah but *I* am the one assisting people, not to walk but to fly > aircraft. To some extent, they depend on me for their lives, and I > take that seriously. So, yes, as a program maintainer, I appreciate > any and all help, assurance and guarantees I can get. So if you like to be as much constrained as possible, I think VB is much better for this. Or even Logo. Plus it provides a turtle to help you. > A C++ program that throws a Window or a Button object or a > Database_Connection object violates the Law of Least Astonishment. If > I read C++ code, I must be prepared to see such things happen, and be > astonished. I have never seen code that throws a button as an exception, although it is feasible to do that. The language is supposed to provide some protection from accidental mistakes, not from intentional coding or irrational minds. > Please explain. I am not a compiler writer, and I fail to understand > how the compiler can allocate on the stack, and then propagate the > exception up the stack. #include class SomeException: public std::exception { const char *errorMessage; public: SomeException(const char *error):errorMessage(error) {} const char *what( ) const throw() { return errorMessage; } }; int main() try { throw SomeException("Something is wrong!"); } catch(std::exception &e) { std::cerr<temp Something is wrong! C:\c> The exception gets copied as it is propagated up to the stack (with the use of the copy constructor). I am not a compiler writer either. -- 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].