Boost logo

Boost :

From: Iain K. Hanson (iain.hanson_at_[hidden])
Date: 2003-09-08 10:04:16


On Mon, 2003-09-08 at 12:29, David Abrahams wrote:
> "Iain K. Hanson" <ikh_at_[hidden]> writes:
>
> >> I'm open to the idea that MI should be banned in exception hierarchies
> >> as an alternative to using virtual inheritance. I don't think
> >> non-virtual multiple inheritance can be justified, though.
> >
> > Ouch! Lets not throw the baby out with the bath water. ( if you'll excuse
> > the pun :-). ).
>
> No, really, let's. We can't afford to keep the baby without the
> bathwater.
ohh. I wanted to have my cake and eat it too ;-). However, I am comming
to the same conclusion as you.

>
> > I'm very definately *not* anti MI. I find the netfile_err example a
> > very natural and intuitive use of MI. What I am unsure of is the
> > recommendation that we should always virtualy inherit from
> > std::exception.
>
> Do you understand the problem? If netfile_err's two bases each has a
> distinct std::exception base class (likely), then
> catch(std::exception&) will fail to catch a thrown netfile_err. That
> seems like a terrible risk to take with something that only happens
> at runtime, and then only extremely rarely.

Yes. I understood that from the beginning. And I understand the danger
and how undesirable it is. I tested virtual base SI versus non virtual
base SI 50 additional lines of code with a virtual base or which is
approx 10% overhead.

My inclination is that however attractive netfile_err is, I don't think
that MI is a general or even common case and I don't like paying for
something I'm not using. So I would go with not supporting MI.

/ikh


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk