C++ exception specifications
2007-05-17 05:09:22.181206+02 by
Dan Lyke
2 comments
I knew that I'd seen the reason for C++ member functions of the form bool abc() const throw() before, but couldn't remember the details. It turns out there are good reasons I wasn't immediately familiar with them: A Pragmatic Look at Exception Specifications:
Moral #1: Never write an exception specification.
Moral #2: Except possibly an empty one, but if I were you I’d avoid even that.
[ related topics:
C++
]
comments in ascending chronological order (reverse):
#Comment Re: made: 2007-05-17 15:11:17.134134+02 by:
markd
and also avoid throwing exceptions across linkable entities. I had a fun time tracking down a behavior
change between two gcc versions when an exception was thrown from one loadable .so to another one.
#Comment Re: made: 2007-05-17 15:18:37.084278+02 by:
other_todd
Good article, and I don't even work in C++ except at gunpoint.
We will not edit your comments. However, we may delete your
comments, or cause them to be hidden behind another link, if we feel
they detract from the conversation. Commercial plugs are fine,
if they are relevant to the conversation, and if you don't
try to pretend to be a consumer. Annoying endorsements will be deleted
if you're lucky, if you're not a whole bunch of people smarter and
more articulate than you will ridicule you, and we will leave
such ridicule in place.