From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-03-20 09:21:40
on 3/20/00 9:10 AM, Andrew D Jewell at ajewell_at_[hidden] wrote:
>> In brief, they provide no compile-time safety and lead to worse generated
>> code on many (if not most) compilers.
> In October of 1998, I exchanged some email with Bjarne Stroustrup on
> this very topic. To way-over-summarize, he asserts that it is almost
> always better to put in an empty exception specification "throw()"
> wherever you can, and occasionally better to add other exception
> specifications "throw(stuff, junk)".
Bjarne's views on matters exception-related have shifted a bit since then. I
don't know what his present view of exception-specifications is, but I can
tell you that there was considerable movement between the time he started
and finished writing his EH appendix.
> I would strongly recommend that boost have separate guidelines for
> empty and full exception specifications; whatever they may turn out
> to be.
If we were targeting only a single compiler which we knew could use it for
optimization, I would agree with this guideline. Unfortunately, many
compilers generate worse (and often much bigger) code when empty
exception-specifications are used.
What is the perceived benefit of using the empty exception-specification?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk