Article View: comp.std.c++
Article #721Re: Exception Specifications
From: Markku Sakkinen
Date: Wed, 30 Sep 1992 16:16
Date: Wed, 30 Sep 1992 16:16
37 lines
2139 bytes
2139 bytes
In article <lci3ptINN3m3@exodus.Eng.Sun.COM> chased@rbbb.Eng.Sun.COM (David Chase) writes:
> ...
>I'd suggest studying the exception specifications in Modula-3 (latest
>version). Those are based on years of experience with Cedar and
> ...
>I do not know how this corresponds to the exception specifications for
>C++; I only know that these are sane and that they work. The use of
>objects types as exception types (as in C++) appears to be compatible
>with this, and an improvement (at least in the case of single
>inheritance).
I am afraid that distinguishing exceptions only by the type of the
'throw' expression is mostly overkill instead of improvement.
Suppose for instance that you have 20 distinct exceptions,
which only need to pass an integer's worth of information
to their handlers (or perhaps no data at all).
You have to declare a class for each of them.
John Skaller has remarked that the exception handling principle
requires run-time type information in the implementation,
a thing against which Bjarne Stroustrup has so steadfastly fought
all these years. (Of course this does not necessarily mean that
the information would be available to the lowly programmers
to misuse.)
Obviously, inheritance between exceptions can be nice
in some situations. That is one advantage of the C++ scheme.
----------------------------------------------------------------------
Markku Sakkinen (sakkinen@jytko.jyu.fi)
SAKKINEN@FINJYU.bitnet (alternative network address)
Department of Computer Science and Information Systems
University of Jyvaskyla (a's with umlauts)
PL 35
SF-40351 Jyvaskyla (umlauts again)
Finland
----------------------------------------------------------------------
Technical Details
Message-ID:
<1992Sep30.161641.24797@jyu.fi>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinenReferences:
<1992Sep29.201603.19289@cs.brown.edu> <lci3ptINN3m3@exodus.Eng.Sun.COM>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!sakkinen From: sakkinen@jyu.fi (Markku Sakkinen) Subject: Re: Exception Specifications Message-ID: <1992Sep30.161641.24797@jyu.fi> Organization: University of Jyvaskyla, Finland References: <1992Sep29.201603.19289@cs.brown.edu> <lci3ptINN3m3@exodus.Eng.Sun.COM> Date: Wed, 30 Sep 1992 16:16:41 GMT Lines: 37