bleading edge by Jack Reeves

  • Thread starter Denis Perelyubskiy
  • Start date
D

Denis Perelyubskiy

Hello,

In the archives of this newsgroup, I found references
to Jack Reeves' "(B)Leading Edge" column.

<http://www.bleading-edge.com/Publications/list.htm>

At this point, I am particularly interested in the
two columns : "Guidlelines for Throwing Exceptions",
and "Guidelines for Using Exception Specifications".

I was wondering if someone could comment on these
(and possibly other) columns with respect to their
applicability: they were written in 1996, and ANSI
approved the standard in 1998. Are there any
inconsistencies that you know about?

thanks...

denis
 
P

Phlip

Denis said:
In the archives of this newsgroup, I found references
to Jack Reeves' "(B)Leading Edge" column.

<http://www.bleading-edge.com/Publications/list.htm>

At this point, I am particularly interested in the
two columns : "Guidlelines for Throwing Exceptions",
and "Guidelines for Using Exception Specifications".

I was wondering if someone could comment on these
(and possibly other) columns with respect to their
applicability: they were written in 1996, and ANSI
approved the standard in 1998. Are there any
inconsistencies that you know about?

The least heinous treatises on exceptions, and how they influence every
other aspect of your style, are the /Exceptional C++/ books by Herb Sutter.
Read and compare with this guy.
 
J

Jerry Coffin

Denis Perelyubskiy said:
Hello,

In the archives of this newsgroup, I found references
to Jack Reeves' "(B)Leading Edge" column.

<http://www.bleading-edge.com/Publications/list.htm>

At this point, I am particularly interested in the
two columns : "Guidlelines for Throwing Exceptions",
and "Guidelines for Using Exception Specifications".

They're amazingly good given their age. The one on throwing
exceptions is still quite good, though perhaps not strongly enough
worded in places. Just for an obvious example, it tells you not to
throw exceptions from destructors. This is good advice, but IMO it
doesn't really go far enough: in a dtor, you must ensure that not only
do you not throw an exception, but that if you do anything else that
could possibly throw an exception, you must trap it and not allow it
to escape.

Likewise with the article on exception specifications: he advises
against using them if you can avoid it, and gives some advice about
how to limit the damage they do when you use them.

My advice would be simpler: don't use them. Ever. Under any
circumstances or for any reason at all.

Some people advise that an exception (no pun intended) be made for the
empty exception specification, but I disagree even with that. It's
still trouble and it makes your code more fragile -- even when you
write a function that you know can't throw, sometime later it'll
inevitably get modified to do something that can throw under _some_
obscure circumstances, and then you have a latent bug. Worse, it's
probably almost impossible to duplicate under laboratory conditions.

Exception specifications were an idea that seemed like a good idea at
the time, but I think it's fairly safe to say they were a mistake.
It's been argued that exception specifications that are checked at
compile time would be an improvement, but expeience with Java (which
has exactly that) mostly seems to indicate that even these are still a
net loss.
 
L

Leor Zolman

Hello,

In the archives of this newsgroup, I found references
to Jack Reeves' "(B)Leading Edge" column.

<http://www.bleading-edge.com/Publications/list.htm>

At this point, I am particularly interested in the
two columns : "Guidlelines for Throwing Exceptions",
and "Guidelines for Using Exception Specifications".

I was wondering if someone could comment on these
(and possibly other) columns with respect to their
applicability: they were written in 1996, and ANSI
approved the standard in 1998. Are there any
inconsistencies that you know about?

Jack actually takes himself to task on these issues with a later Bleading
Edge column in the CUJ Expert's Forum:
http://www.cuj.com/documents/s=8247/cujcexp2103reeves/

-leor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top