From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-30 16:58:32
Bronek Kozicki wrote:
> Peter Dimov <pdimov_at_[hidden]> wrote:
>> Jessie Hernandez wrote:
>>> The above hierarchy, I think, is the best of both worlds: you have a
>>> minimal number of exception classes covering broad types of errors.
>> But _why_ is having a minimal number of exception classes a virtue?
> Maybe just because LWG do not like to have many exception classes, and
> we are striving to create something which could be accepted into
> future version of standard C++ library ?
Please. The LWG members aren't stupid, they are capable of recognizing good
design when they see it. We should be striving to come up with the best
> But I can see other point. This is about how exception hierachies are
> being used in C++ standard library. Currently C++ standard has very
> few exception classes which could be reused by all classes
> (runtime_error, logic_error and family), single exception class per
> language domains (bad_cast, bad_alloc, bad_exception, bad_typeid) and
> single exception in whole IO part of the standard library
The standard library isn't very consistent in its use of exceptions, and
many of its parts aren't really an example of good design. ios_base::failure
in particular is an exception that is pretty much useless.