Prev: const is an overrated concept that is a source of extra typing and maintenance
Next: Using template parameters to simplify interfaces
From: Mathias Gaunard on 28 Mar 2010 05:44 On 26 mar, 22:44, Stephen Howe <sjhoweATdialDOTpipexDOT...(a)giganews.com> wrote: > Both bother me in that at the point where something has gone wrong, I usually > wish to return _more_ than just a bald error code > (e.g. line number, function, any other pertinent information etc). I guess an > exception is better as an object can be packaged > up and thrown. That looks more like the job of logging than of exceptions. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: A. McKenney on 28 Mar 2010 06:05 I generally stay out of Holy Wars, but this statement got to me: On Mar 22, 2:04 pm, "Daniel T." <danie...(a)earthlink.net> wrote: > I think everybody agrees that in C++ you should > use exceptions for error handling. For sufficiently restrictive definitions of "everybody," I suppose so. But you'd have to exclude me. I would not agree to such a blanket statement, as can be seen by my response early on in this thread. IMAO, exceptions are like any other language construct: facilities which have their advantages and disadvantages. They should be used if they fit your situation better than the alternatives. You really have to know the requirements and constraints and then use your judgement. That's why we get the big bucks. > The only controversy I see is in how we define "error." > Some people define it broadly, others define it narrowly. Well, if you define "error" as "something that should throw an exception".... -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Peter C. Chapin on 29 Mar 2010 06:17
A. McKenney wrote: > But you'd have to exclude me. I would not agree to > such a blanket statement, as can be seen by my response > early on in this thread. I agree that there are times when exceptions are not necessarily the best way of handling errors. For example exceptions are hard to analyze statically. People interested in writing high integrity software who rely on deep static analysis thus might want to forbid exceptions. I'm not sure what is done by the C++ in this area, but the SPARK sublanguage of Ada forbids exceptions for exactly this reason. Peter -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |