🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #740

Re: Exception Specifications

#740
From: Olli-Matti Penttinen
Date: Sat, 03 Oct 1992 01:54
27 lines
2143 bytes
Matt> If an object can throw 18 exception types, then clients will need
Matt> to understand all those types, and their implications -- and
Matt> perhaps then, something of the internal workings of that object,
Matt> in order to understand how to respond to a particular exception.

By carefully deriving exception types, the clients needn't worry about
details they really don't understand or care about.

Matt> It might be better to cause the functions in the objects
Matt> interface (the top level functions of the object) to throw only a
Matt> limited set of exceptions, perhaps only one, and handle all other
Matt> exceptions themselves (print an error message or log, take some
Matt> constructive action, etc.).

Rather, let them throw any number of exceptions, but make sure the
exception types have a limited number of distinct base classes. The
ability to derive exception types is the very feature that makes C++
exceptions superior to -- say, Ada's. Client code can catch them with
the accuracy it needs to instead of what the library says.


==pena
--
Olli-Matti Penttinen <pena@niksula.cs.hut.fi>
Lehdesniityntie 3 F 91
00340 HELSINKI                     "When in doubt, use brute force."
tel. + 358 0 1399 0110                -- Ken Thompson
Technical Details
Message-ID: <PENA.92Oct3015409@colossus.hut.fi>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!uwm.edu!wupost!darwin.sura.net!Sirius.dfn.de!dct.zrz.tu-berlin.de!math.fu-berlin.de!unidui!rrz.uni-koeln.de!Germany.EU.net!mcsun!news.funet.fi!ajk.tele.fi!funic!nntp.hut.fi!nntp.hut.fi!pena
References: <1992Sep29.201603.19289@cs.brown.edu> <1992Sep30.205656.10646@lucid.com> <1992Oct01.143355.27847@bnr.ca>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!uwm.edu!wupost!darwin.sura.net!Sirius.dfn.de!dct.zrz.tu-berlin.de!math.fu-berlin.de!unidui!rrz.uni-koeln.de!Germany.EU.net!mcsun!news.funet.fi!ajk.tele.fi!funic!nntp.hut.fi!nntp.hut.fi!pena
From: pena@niksula.hut.fi (Olli-Matti Penttinen)
Subject: Re: Exception Specifications
In-Reply-To: holiday@bnr.ca's message of 1 Oct 92 14:33:55 GMT
Message-ID: <PENA.92Oct3015409@colossus.hut.fi>
Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
Nntp-Posting-Host: colossus.cs.hut.fi
Organization: Helsinki University of Technology, Finland
References: <1992Sep29.201603.19289@cs.brown.edu> <1992Sep30.205656.10646@lucid.com>
 <1992Oct01.143355.27847@bnr.ca>
Date: 3 Oct 92 01:54:09
Lines: 27