Path: news.daimi.aau.dk!news.uni-c.dk!newsfeed.sunet.se!news00.sunet.se!sunic!news.sprintlink.net!news.frontiernet.net!news.his.com!news2.cais.net!news.cais.net!news.jsums.edu!gatech!news.mathworks.com!uunet!in2.uu.net!hoho.quake.net!usenet From: billf@jovial.com (Bill Foote) Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather Subject: Re: What Should An Exception Handling Do? -- Clarification of rules Date: 23 Mar 1996 05:55:47 GMT Organization: Jovial Lines: 35 Message-ID: <4j03p4$fbt@hoho.quake.net> References: <1996Mar14.155641.4299@schbbs.mot.com> <4irn11$7ln@mimas.brunel.ac.uk> NNTP-Posting-Host: l89.ip.quake.net Xref: news.daimi.aau.dk comp.object:53080 comp.lang.eiffel:22469 comp.lang.c++:174547 comp.lang.beta:10676 comp.lang.java:27828 comp.lang.sather:12354 In article , Matthew Travis wrote: >H'llo, > for clarification, Java uses the same exception handling >mechanism as C++ (with the addition of the finally clause). The two >possible mechanisms are "resumption" and "termination". A quote from the >"Annotated C++ Reference Manual" states: > > "Exception handling is intended to allow code that has encountered >a condition it cannot cope with to return to some other code that >directly or indirectly invoked it. There is no way for an exception >handler to request the thread of control to resume from the throw point. >In other words, "throw" implements the termination model of exception >handling." -ARM, Ellis & Stroustrup, page 354 > >This model has been accepted into the draft C++ standard and is also the >model Java uses. The philosophy is that an exception indicates some error >condition that is usually unrecoverable and code that is in error should >terminate (thinking about it logically). A cynic might conclude something more along these lines: "It would be hard to implement resumable exceptions in C++, so they decided to punt." It's not too hard to come up with examples where it would be nice to have resumable exceptions. One example is resource acquisition. Upon failure to acquire a resource (a file descriptor, some memory, etc.) it might be nice if a top-level exception handler could try to free up some resources, and if it can, try to resume from the exception. Oh well. -- Bill Foote | L'homme est né pour vivre dans les billf@jovial.com | convulsions de l'inquiétude ou dans la http://www.jovial.com/~billf/ | léthargie de l'ennui -- Voltaire