On 28 Mar, 22:05, "A. McKenney" <alan_mckenn...@yahoo.com> wrote:
On Mar 22, 2:04 pm, "Daniel T." <danie...@earthlink.net> wrote:
I think everybody agrees that in C++ you should use exceptions for
error handling.
In general I do agree with this. FWIW it is also mentioned in "Clean
Code" by Uncle Bob.
IMAO, exceptions are like any other language construct: facilities
which have their advantages and disadvantages.
But the main advantage of not using them is speed and the improvement
you get is not worth the disadvantages for most apps, IMHO (I
mentioned telecoms earlier in this thread as an example of where it
can matter).
It is interesting to note that this debate does not seem to occur with
other languages. You don't see people discussing exceptions versus
error codes for java. Or python. Or Eiffel. Error codes are a way of
doing things from earlier languages, such as C, and many people moved
to C++ from C. I don't think it would ever occur to a young programmer
who is just starting with java to use error codes.
I am pretty sure that Eiffel programmers wouldn't ever consider using
them either and that is an example of a language that compiles down to
native code, where presumably, people might use it for apps that
really have to perform.
should re-throw. In Eiffel, the only exits from a catch block is to
retry the function or re-throw. In C++, that would mean something along
}. Something like:
[ comp.lang.c++.moderated. First time posters: Do this! ]