Boost logo

Boost :

From: Reid Sweatman (reids_at_[hidden])
Date: 1999-07-07 14:56:01

> Yes. Perhaps Dave Abrahams, who developed the rationale, can give me
> clear wording for the docs, but the roughly it is an efficiency
> consideration - if you say throw(), the compiler may have to
> internally wrap the code in a try block to ensure nothing gets
> thrown. It is not all that clear in my mind that it is ever a good
> idea to say supply an empty throw specification.

I've been lurking lately, but this one struck close to home, because I've
always taken it as an article of faith (based mostly on a couple of editions
of "C++ FAQs," the expanded book version of the Usenet FAQ) that you should
decorate functions when you're sure (and yeah, I know you can't be sure)
they won't throw. However, I pretty well knew what your answer was going to
be. Now, I'm just confused <g>. Should I go back through my codebase and
remove all those empty throw() decorations (my editor template is rigged to
automatically insert them)?

Basically, I guess I'm asking whether you, or anyone else (make sure 'e
doesn't leave the room...<sorry<g>>) can point me to a book or other source
that discusses this issue. It seems to me that without the decoration, the
function *could* throw, and without that compiler-generated excess baggage,
you wouldn't even get an unexpected exception, leaving it to a higher
function to catch. Unfortunately, since the function was assumed not to
throw, that higher function probably wouldn't know what to do with the
exception. Comments?

------------------------------------------------------------------------ home: - Simplifying group communications

Boost list run by bdawes at, gregod at, cpdaniel at, john at