|
Boost : |
Subject: Re: [boost] [system][filesystem v3] Question about error_codearguments
From: Detlef Vollmann (dv_at_[hidden])
Date: 2009-10-31 20:37:04
On 10/31/09 12:48, Andrey Semashev wrote:
> Detlef Vollmann wrote:
>
>> But the basic problem of throwing exceptions from destructors exists,
>> and is IMO a major flaw of how exception handling works in C++,
>> but I don't think that this will change.
>
> FWIW, the language allows to work around this problem. You can use
> std::uncaught_exception to detect whether to throw exception in a
> destructor or not.
This was already discussed earlier in this thread.
And the issue is not so much that uncaught_exception() doesn't
always return what you want to know ("is it safe to throw?"),
but the exception safety guarantees that break if a destructor throws.
> Regarding the original idea of returning an object that would throw in
> its destructor, I don't see this problem at all, as this object can only
> be returned if there is no exception propagating. However, I can't say
> I'm in favor of this idea.
I still somehow like it, but there are to many problems with it.
Detlef
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk