Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-09-30 22:08:09


> > <snip>
> > Optimizing the memory allocations made by Boost Exception when info is
> > added to exception objects can not be dismissed as easily, but I would
> > not call those allocations unnecessary. :)
>
> But I believe that we should be able to allow not making any heap
> allocation within some measure.

In theory the allocator support in the shared_ptr inside the
boost::exception class can be used to abstract the actual allocations.
While I'm not opposed to that in principle, I can't think of many
environments that would welcome exceptions but not welcome memory
allocations.

> My biggest concern is bad_alloc being thrown and the exception being
> replaced. It might not be as bad for most cases, but may be critical
> in others.

Suppose we catch a bad_alloc, then (for reasons that are hard for me
to imagine) we throw something_else, which derives from
boost::exception, and we attempt to stuff it with all kinds of info.
The two possible outcomes are, it either works fine, or we get another
bad_alloc instead of something_else.

I don't see how this could cause any problems (any more than the
original bad_alloc would).

Emil Dotchevski


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