Boost logo

Boost :

From: Greg Colvin (greg_at_[hidden])
Date: 2000-07-16 22:21:53


From: Lois Goldthwaite <loisg_at_[hidden]>
> Some of our tests in Hawaii showed that at least one compiler was able to use the
> "throw()" specification to generate more optimized code, not less.
>
> I thought we had a general principle to write "ideal" code and let the compilers
> catch up. If our target compilers are capable of compiling code with exception
> specifications, albeit with some loss of efficiency, I think this is a
> documentation issue.
>
> As I understand the purpose of throw specs, they should contribute to greater
> robustness of code, and I believe there is some talk of strengthening the
> language support for them next time around. Why pessimize the source code out of
> fear the (currently inadequate) compiler will pessimize the output? (Unless, of
> course, the output is so woefully inefficient that it becomes absolutely
> necessary, but that should be a case-by-case decision, as Howard says.)

As Beman noted:

> smart_ptr.hpp has throw specifiers on a number of time-critical inline
> functions such as dereferencing:
>
> T& operator*() const throw() { return *ptr; }
>
> It's a disaster if these aren't inlined.

So this is a particulary bad case.

Do we need a BOOST_THROW_SPEC_IF_NOT_BRAIN_DEAD macro?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk