Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-10-02 21:51:25


> [snip]
>
> > The easiest way to port existing code to using boost::exception is to
> > use enable_error_info. This adds no boilerplate code, and requires no
> > changes to any exception classes. All you have to do is replace "throw
> > my_exception(a,b,c)" with "throw
> > enable_error_info(my_exception(a,b,c))".
>
> Has the approach of saving all data to a global structure (instead of
> to the exception class hierarchy itself) been considered?
> PS: I'm not suggesting it should be done that way, but only asking if
> it was considered at all.

You can not use global storage for the data that's stored in exception
objects because in general, multiple exception objects can be active
at the same time (this has nothing to do with boost::exception, it's
just the way exceptions are defined in C++.)

Emil Dotchevski


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