|
Boost : |
Subject: Re: [boost] [Exception] Why is there no non-constversionofget_error_info?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-08-21 13:44:29
On Thu, Aug 20, 2009 at 10:29 PM, Adam Badura<abadura_at_[hidden]> wrote:
>> Are you sure the reserve() will reduce the risk significantly? Note
>> that boost::exception_ptr itself also allocates memory, not to mention
>> the onNotify functions themselves, assuming they aren't trivial they
>> could be allocating things as well.
>
> If onNotify throws due to lack of memory then it is just as if it threw
> anything else. (Except for slightly larger risk of failure in throwing
> MultiException due to lack of memory for the exception itself.)
std::string get_file_name();
throw foo() << boost::errinfo_file_name(get_file_name());
All I was saying is that if op<< throws std::bad_alloc, this is the
same as getting std::bad_alloc from the get_file_name() function or
from the std::string copy constructor, or even from the runtime if it
runs out of memory trying to throw (the already successfully
initialized with error infos and all) foo. You shouldn't worry about
this stuff, just collect your exception_ptrs in a std::vector then add
it to the exception at the point of the throw.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk