Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-20 16:40:09


"Fernando Cacciola" <fernando_cacciola_at_[hidden]> writes:

> I'm not sure if a boost exception class is *needed*, but I see no problem in
> having one.
> Anyway, IIF such an exception class is defined, I *strongly* encourage (as I
> did in the past) that it provides:
>
> virtual void raise() const
> {
> #ifndef BOOST_NO_EXCEPTIONS
> throw *this ;
> #endif
> }
>
> and that boost libraries throw such exceptions *only* by calling .raise():
> i.e. never with a throw expression directly in the user code.

1. Why should this be a virtual function? The dynamic type of an
   exception object is never used in a throw expression.

2. Why are we reinventing the wheel? What's wrong with
   boost::throw_exception() from boost/throw_exception.hpp?

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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