Boost logo

Boost :

From: Alan.Griffiths_at_[hidden]
Date: 2003-09-02 05:43:37

I've recently been discussing the guideline recently added to the exceptions
policy page with Dave Abrahams and he has asked me to post my views here.

There is a seductive form of arguement that I've seen repeatedly lead
projects into trouble which has made me very suspicious of the form:
"provide X because someone might want to do Y". One common example is
"provide public access to member data because someone might need to do
something with the members that isn't supported directly". (I hope that
this is a forum that would reject this argument.) Another arguement I've
encountered recently is that "all classes should have a virtual destructor
because someone may want to specialise them".

The arguement is especially seductive when the cost of "providing X" is
either small or hidden. But many a project has failed through creeping
featuritis driven by such concerns. The cost of virtual inheritance from
std::exception may well appear small - indeed, most of it is the
intellectual cost of understanding the intent.

Arguments of this form need to be challenged on the basis of whether "to do
Y" is a reasonable expectation. If not, then the solution isn't "provide X"
it is "discourage Y".

Now, unlike the examples cited above, I've *never* encountered anyone
arguing that exception hierarchies should be designed to support MI in a
real design scenario. Nor, when challenged on this point, has Dave. The
hypothetial example cited seems very implausible: when developing a
subsystem to meet two interfaces I invariably develop a pair of adaption
wrappers over the core functionality. (And, in general, repackaging of
exceptions is a very small part of that wrapper.)

The obvious conclusion from the example cited is "don't multiply inherit
from classes that are not designed to support it".

I'm always willing to learn, but in the absence of a compelling example that
MI is useful in exception heirarchies, I am unwilling to support the new


Sorry for starting a new thread, but I cannot connect to gmane from work and
home is 130 miles away.

For more information about Barclays Capital, please
visit our web site at

Internet communications are not secure and therefore the Barclays
Group does not accept legal responsibility for the contents of this
message. Although the Barclays Group operates anti-virus programmes,
it does not accept responsibility for any damage whatsoever that is
caused by viruses being passed. Any views or opinions presented are
solely those of the author and do not necessarily represent those of the
Barclays Group. Replies to this email may be monitored by the Barclays
Group for operational or business reasons.


Boost list run by bdawes at, gregod at, cpdaniel at, john at