Topic: tree or forest exception hierarchy?
Author: Raymond Fergerson <rwf@camis.stanford.edu>
Date: 1995/11/09 Raw View
My understanding is that the current ANSI draft specifies a
number of standard exceptions which form an
inheritance forest, but not a tree: there is no common root.
I also heard that this choice was the subject of much debate at
the meetings. Could someone please present a summary of the
arguments both for and against using a tree structure for the
standard exception hierarcy. Did Stroustrup express an opinion
on this subject, and, if so, which way did he lean? Was multiple
inheritance in the use of exceptions the big issue?
Ray
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Author: herbs@interlog.com (Herb Sutter)
Date: 1995/11/11 Raw View
In article <47va08$8lb@gabi.gabi-soft.fr>,
kanze@gabi-soft.fr (J. Kanze) wrote:
>As far as I can see, all of the exceptions thrown by the standard
>library derive from the class exception, so they form a tree, not a
>forest.
>
>This seems logical to me; the isA relationship definitly holds, and
>there is a fundamental relationship (as opposed to the case of an Object
>class, from which everything derives). I would even suggest that unless
>there were very strong motives for doing otherwise, applications base
>their exception hierarchy on the one used by the standard library.
I notice this isn't covered in Cline's online FAQ, but it is covered in his
book (highly recommended: "C++ FAQs", Addison-Wesley, 1995, ISBN
0-201-58958-3). See Section 21, "Tactical Advice for Exception Handling",
where the very first entry (FAQ #261) launches right into this question.
BTW, I concur heartily with James' last remark. At the moment I can't imagine
a motive for doing otherwise, actually, that couldn't be solved by simply
gathering your own exceptions under a root that's derived from 'xmsg' (or
'exception'? is that the correct DWP name?) and ignoring the fact that you're
in the tree when you want to ignore it.
Herb
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herb Sutter 2228 Urwin, Ste 102 voice (416) 618-0184
Connected Object Solutions Oakville ON Canada L6L 2T2 fax (905) 847-6019
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]