TITLE: general consensus on using exceptions (Newsgroups: comp.lang.c++.moderated) PROBLEM: Michael Schuerig (uzs90z@uni-bonn.de) I'm reading this group for about three weeks and all of the time (and I guess several weeks or months back) there has been a heavy discussion of exceptions. I must admitt that I haven't read anything of it; I came to late and don't have any experience with exceptions. I'd very much appreciate if some kind soul could summarize what's happened; what the lesson are to be learned for proper error handling and what newbies ought to look out for. (BTW, I already know Scott Meyer's _More Effective C++_ and Tom Cargill's "Exception Handling" -- a newbie I am nontheless.) RESPONSE: kjhopps@mmm.com (Kevin J Hopps), 3 Jun 96 I'll try to summarize the discussion. Both the proponents and opponents of exceptions seem to agree that error handling is a difficult but important thing; no particular choice of error reporting mechanism takes away the responsibility of thinking about errors when designing or coding software. We all also seem to agree that exceptions make it more difficult to write "safe" code. That is, code which neither leaks resources nor leaves objects in inconsistent states. I think all would agree that one of the main reasons for this is that exceptions break the normal flow of control and make it impossible to write single-entry/single-exit blocks of code. I think all would also agree that lack of experience is also a factor in how difficult it is to write safe code using exceptions. We all agree that there are viable alternatives to exceptions, at least in most cases. I think we all agree that the mere fact that exceptions are part of the standard gives them a certain intrinsic value over other non-standard techniques. We do not agree on how much of an effect experience will have on the ease with which exception safe code can be written. We do not agree on the degree to which preservation of the single-entry/ single-exit style warrants reluctance to use exceptions. We do not all agree on how the use of exceptions affects the readability of the code. To some, the code reads much better because it appears to be concerned primarily with the "no-errors" flow of control. To others, exceptions are a hidden control structure which increases the likelihood errors. We do not agree on the relative merits of an error reporting mechanism being standard vs. its being technically superior. (This may be due to the different deployments of the code we are each writing rather than some disagreement on principle.) Based on the discussion in a long thread in this group, I'm not sure anybody has been significantly swayed one way or the other. IMHO this is not because of stubbornness, but because there is no clear answer. [snip]