
1 Oct
2007
1 Oct
'07
6:30 a.m.
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.