Re: Exceptions, Go to Hell!
Stuart Redmann <DerTopper@web.de> wrote:
thomas wrote:
Hi,
Sometimes I found it very convenient to use STL in my application.
But one thing I hate is that STL containers throw exceptions. Because
we handle errors explictly in our application, we don't want
exceptions.
I want to know whether there's any possibility to turn exceptions off,
just like the "new(std::nothrow)" option.
That would be quite nice.
Exactly how would that be "quite nice"? What do you suggest the containers
do in case of an error? Silently misbehave? Something else? What?
When you start thinking about how you would be able to detect any
possible errors with STL containers, you will find that exceptions are,
in fact, the *easiest* and most practical way of doing that. Any other
method you might think of (such as putting an error code somewhere which
you would have to check) would result in much more complicated code from
your part and, more importantly, would result in significantly more
error-prone code (because you *will* forget to check such error codes).
Of course a data container silently misbehaving in case of error would
be the worst possible solution. By far.