Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-10-01 02:36:26


On 9/30/07, Emil Dotchevski <emil_at_[hidden]> wrote:
> > 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
>

Yes.

> 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.

Sorry about that, but the idea was to throw an exception and add more
stuff into it as the stack unwinds and the exception propagates.

-- 
Dean Michael C. Berris
Software Engineer, Friendster, Inc.
[http://cplusplus-soup.blogspot.com/]
[mikhailberis_at_[hidden]]
[+63 928 7291459]
[+1 408 4049523]

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