[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using C++ exceptions is not a good idea in general - but why?
On Wed, 8 Dec 1999, Shaul Karl wrote:
> Why do you think that using exceptions is not a good idea in general?
because they are evil :)
but seriously, i try to use exceptions as little as possible. they tend to
cause generation of ugly code, and people tend to over-use them even in
cases where a simple return value from a function would do.
another problem is that a function can throw an exception it did not
declare (either directly, or because a function it calls threw it) and you
find it very hard to catch such exceptions in a meaningfull way.
one more problem: when one hrows an exception that is only caught by a
general-purpose exception handler (e.g. catching of "unknown" exceptions
as possible with sun C++, etc), the stack gets unwinded, and thus any code
file generated is almost impossible to read - a simple call to abort() in
the place where the problem occured (e.g. using assert() ) would leave a
meaningfull core file that can be debuged.
guy
"For world domination - press 1,
or dial 0, and please hold, for the creator." -- nob o. dy
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il