Subject: Re: [boost] [system][filesystem v3] Question about error_codearguments
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-10-29 17:42:17
On Thu, Oct 29, 2009 at 2:20 PM, Michael Fawcett
> On Thu, Oct 29, 2009 at 5:07 PM, Emil Dotchevski
> <emildotchevski_at_[hidden]> wrote:
>> On Thu, Oct 29, 2009 at 1:46 PM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
>>> It's simple:
>>> if (error-not-checked && !std::uncaught_exception())
>>> throw something;
> I've read that article before. To me it only seemed applicable to
> destructors that actually did something, like a rollback. For an
> object that does nothing in its destructor, do you think Herb's
> arguments still apply?
The point is that a destructor could call a function that returns this
sneaky error code object, and end up throwing an exception. You can
argue that this is a bug, but that's exactly why it is evil -- for
anything but a trivial toy example, such code can't reasonably be
tested because it is very difficult to reproduce the conditions that
could possibly lead to abort().
Why not just pick a behavior -- throw on error, or don't throw on
error -- whichever is correct?
Reverge Studios, Inc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk