Article View: comp.std.c++
Article #4036Re: Use of standard exception classes
From: Fergus Henderson
Date: Mon, 15 Apr 1996 07:18
Date: Mon, 15 Apr 1996 07:18
58 lines
3348 bytes
3348 bytes
kcline@spdmail.spd.dsccc.com (Kevin Cline) writes: >In "The Standard C++ Library" on page 65, Plauger wrote: > > "I strongly encourage you to follow the lead of the Standard C++ > library in the use of exceptions: > * Throw only objects of one or more classes derived from [exception] > >Page 19-1 of the 4/95 version of the draft says "The Standard C++ >library provides classes to be used to report errors in C++ programs." > >But in section 19.1.1 of the same draft it says: > >"The class exception defines the base class for the types of objects > thrown as exceptions by *C++ Standard library components*, and certain > expressions, to report errors detected during program execution." Section 19.1/1 (that is, section 19.1 paragraph 1) of the Jan 96 draft states it more clearly: | 19.1 Exception classes [lib.std.exceptions] | | 1 The Standard C++ library provides classes to be used to report certain | errors (_lib.res.on.exception.handling_) in C++ programs. Note that section 19.1.1 is | 19.1.1 Class logic_error [lib.logic.error] which is probably not the section to which you were referring. I find it helpful to use `.' for sub-section numbers and `/' for paragraph numbers, to avoid confusion. >Can someone on the committee indicate whether it was the committee's >intention for the standard exception class hierarchy to be used in >general C++ programming, or whether the intention was for the standard >exception class hierarchy to be reserved to the Standard C++ library? I believe the emphasis on "by *C++ Standard library components*" was simply intended to stress the point that other C++ code didn't have to throw only objects derived from class `exception' (as I believe was mooted in some previous designs for C++ exception handling). It was not intended to suggest that user's C++ code could not do so, only that they did not have to do so. I guess this wording was recognized as being confusing, since it has now been replaced. I would still consider Plauger's advice quoted above as good advice. -- Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp. --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<4kqua6$3sv@mulga.cs.mu.OZ.AU>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<9604121530.AA08606@sun132.spd.dsccc.com>Show Full Headers
Complete Article Headers
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson) Message-ID: <4kqua6$3sv@mulga.cs.mu.OZ.AU> X-Original-Date: 14 Apr 1996 13:24:22 GMT Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 15 Apr 96 07:18:50 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Subject: Re: Use of standard exception classes Organization: Comp Sci, University of Melbourne References: <9604121530.AA08606@sun132.spd.dsccc.com> X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMXH4feEDnX0m9pzZAQFLngGAmXlyQnfjuHRGGaj532TqcO+45egrpZU2 TsJLcRgrWCvXagfyTdziepdyWKow5Qeg =ME1R