Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-10-01 02:30:42


> try {
> try {
> ...
> } catch (std::bad_alloc & e) {
> throw boost::exception() << error_info<tag::long_double>(0xFF);
> };
> ...
> } catch (boost::exception & e) {
> e << error_info<tag::long_double_still>(0xFF);
> throw;
> };

Do I understand correctly that you are worried about a bad_alloc
propagating up the stack, after:

1) you catch bad_alloc

2) you stuff something in a boost exception, which allocates memory successfully

3) you catch that exception after some stack unwinding (which
presumably frees more memory) and then you attempt to stuff some more
info in it

Emil Dotchevski

P.S. For the sake of clarity, I should say that you can not throw a
boost::exception: it's an abstract base class.


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