From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Help Me Please :)
Date: 2000/03/19
Date: 2000-03-19T00:00:00+00:00 [thread overview]
Message-ID: <wccd7oqd7jf.fsf@world.std.com> (raw)
In-Reply-To: UmCA4.6424$iP.440912@bgtnsc04-news.ops.worldnet.att.net
"James S. Rogers" <jimmaureenrogers@worldnet.att.net> writes:
> Have you ever used exceptions in C++?
No. The last time I used C++ (some years ago), most compilers did not
support exceptions. The closest I could get was reading about them in
Stroustrup's book. But I have used exceptions in other languages that
define exceptions as first-class objects.
>...Very few people do.
> The problem arises from the fact that exceptions are first class objects.
I don't understand this problem. Perhaps you could give an example? Is
the problem you're talking about C++-specific, or are you claiming it's
a fundamental problem with the idea of exceptions-as-objects?
One problem I see with C++ exceptions is that anything can be an
exception -- you can throw a string or an int or whatever. I would
prefer to have a distinguished exception class, and then you could
define new exceptions by subclassing that. Several other languages that
have first-class exceptions do exactly that. But this seems like a
minor issue.
> In C++ you cannot "catch" an exception without knowing its type. This means
> that you must have exquisite coupling with all your dependent compilation
> units
> to use exceptions reliably. This coupling requirement works strongly against
> encapsulation and modularity.
Again, I don't get it. Of course you can't catch an exception without
knowing its type. Just like in Ada you can't handle an exception
without knowing its name. I don't see how that breaks encapsulation and
modularity.
> The only way around this is to declare a single exception type for all
> exceptions
> generated by an application. This leaves you in the same position as you are
> in Ada. Of course, the problem with this solution for C++ is that you will
> probably use
> class libraries, which, if they use exceptions at all, will probably not
> conform to the
> exception class chosen by your team. If this is the case, then you are in a
> much
> worse situation than if you used Ada.
- Bob
next prev parent reply other threads:[~2000-03-19 0:00 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-29 0:00 Help Me Please :) Will Mann
2000-03-01 0:00 ` Robert Dewar
2000-03-03 0:00 ` Florian Weimer
2000-03-03 0:00 ` tmoran
2000-03-04 0:00 ` Richard D Riehle
2000-03-05 0:00 ` Steve Arnold
2000-03-17 0:00 ` Robert A Duff
2000-03-18 0:00 ` Richard D Riehle
2000-03-18 0:00 ` James S. Rogers
2000-03-19 0:00 ` Robert A Duff [this message]
2000-03-20 0:00 ` Brian Rogoff
2000-03-20 0:00 ` Tucker Taft
2000-03-20 0:00 ` Florian Weimer
2000-03-22 0:00 ` Mats Weber
2000-03-27 0:00 ` Robert A Duff
2000-03-27 0:00 ` Hyman Rosen
2000-03-28 0:00 ` reason67
2000-03-28 0:00 ` Robert Dewar
2000-03-29 0:00 ` reason67
2000-03-29 0:00 ` Simon Wright
2000-04-06 0:00 ` Simon Pilgrim
2000-04-07 0:00 ` Robert Dewar
2000-04-10 0:00 ` r_c_chapman
2000-03-28 0:00 ` Robert Dewar
2000-03-30 0:00 ` Mats Weber
2000-04-06 0:00 ` Exceptions (was: " Wes Groleau
2000-04-07 0:00 ` Mats Weber
2000-03-29 0:00 ` Richard D Riehle
2000-03-29 0:00 ` Robert Dewar
2000-03-31 0:00 ` Richard D Riehle
2000-03-31 0:00 ` Jean-Pierre Rosen
2000-03-31 0:00 ` Pascal Obry
2000-03-30 0:00 ` Mats Weber
2000-03-31 0:00 ` Richard D Riehle
2000-04-06 0:00 ` Wes Groleau
2000-03-30 0:00 ` Mats Weber
2000-03-30 0:00 ` Tucker Taft
[not found] ` <2000Mar3.183321.69279@ludens>
2000-03-03 0:00 ` Larry Kilgallen
2000-03-04 0:00 ` Robert Dewar
-- strict thread matches above, loose matches on Subject: below --
2000-02-29 0:00 Will Mann
2000-02-29 0:00 ` Stanley R. Allen
2000-02-29 0:00 ` Al Johnston
2000-03-01 0:00 ` Stanley R. Allen
2000-03-01 0:00 ` Robert Dewar
2000-03-01 0:00 ` Al Johnston
2000-03-01 0:00 ` tmoran
2000-03-01 0:00 ` Al Johnston
2000-03-02 0:00 ` Aidan Skinner
2000-03-01 0:00 ` Robert Dewar
2000-03-01 0:00 ` James Bean
2000-03-01 0:00 ` tmoran
[not found] <df481109.0106140310.5d923746@posting.google.com>
[not found] ` <9gb1uu$87u7o$1@ID-52877.news.dfncis.de>
2001-06-19 2:59 ` help me please! Ken Garlington
2001-06-16 10:20 ` C.D.Damron
2001-06-20 6:06 ` John Keeney
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox