Boost logo

Boost :

From: Kevlin Henney (Kevlin.Henney_at_[hidden])
Date: 1999-10-11 06:25:44

Dave Abrahams wrote:
> Adam Levar wrote:
> The definition of bad_numeric_cast in cast.hpp is missing the no throw
> specifier on the what() method.
> Yes, well spotted -- humans still seem to have the edge on
> Thanks, Kevlin.

Think twice before putting empty exception-specifications on functions that
don't throw, then think again:

This will result in no compile-time checking
The run-time behavior is not advantageous
Few compilers can use it for optimization
Even among those that do, it will usually only result in a small reduction
in executable size
Many compilers will use it for pessimization, resulting in a large cost in
executable size and often, speed.

     Yes, this is all true when introducing new classes into a system.
     However, because throw specs must be covariant wrt inheritance and
     overriding virtual functions, bad_numeric_cast is required in this
     case -- it is an error for it not to be (hence my comment about humans
     having the edge on compilers :->).


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