>>> On 24-01-07 at 10:42, in message
<[EMAIL PROTECTED]>, "Jeroen
T.
Vermeulen" <[EMAIL PROTECTED]> wrote:
> On Tue, January 23, 2007 15:54, Marcel Loose wrote:
>
>> The problem I have with multiple inheritance is that it can cause
>> subtle bugs. And the place where you least want anything to go awry
is
>> in exception classes. However, when implemented properly, there's
>> nothing against using multiple inheritance. I don't remember,
though,
>> that I've ever seen a exception class hierarchy using multiple
>> inheritance.
>
> Of course multiple inheritance can cause subtle bugs; anything can
lead to
> subtle bugs, including defining main(). But what in particular did
you
> have in mind? The only pitfalls with multiple inheritance that
spring to
> my mind at the moment are in implementing the hierarchy itself--when
to
> use virtual base classes, avoiding problematic ambiguity, declaring
> functions as virtual in the right place and so on. We're talking
about a
> mixin in a very simple hierarchy here, with just one pure-virtual
> declaration of what() and trivial constructors.
>
> There's still the slicing problem, of course, but that exists even
with
> plain old single inheritance.
>
>
>> The point I was trying to make w.r.t. logic_error and runtime_error
is
>> that IMHO they are not so useful as base classes for your own
exception
>> classes. One of the reasons is, that (ignoring the option of using
>> multiple inheritance) it is impossible to have one base exception
class
>> for your own exceptions. BTW, I'm not alone in this. Bjarne
Stroustrup
>> writes in "The C++ Programming Language, Special Edition" in
section
>> 14.10 w.r.t. the STL exception hierarchy: <quote> Some people view
this
>> as a useful framework for all errors and exceptions; I don't.
</quote>
>
> I have the same edition. Still, I try to fit in with what's provided
as
> much as possible--and extend the hierarchy where it helps. I think
> multiple inheritance could really help by providing an additional
taxonomy
> of errors besides this one. At least it helps take away questions
like
> "should this be a range_error *or* a libpqxx error?"
>
>
> Jeroe
Hi Jeroen,
I agree that, in this relatively simple case, there's not really much
that can go wrong with multiple inheritance. If you wouldn't mind adding
a mixin pqxx::exception_base class to your exception hierarchy, I'd be
very happy. Because then I will be able to catch any pqxx-related
exceptions while letting others pass. Please let me know what you
decide.
Regards,
Marcel Loose.
_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general