Boost logo

Boost :

Subject: Re: [boost] [function] function wrapping with no exceptionsafetyguarantee
From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2010-10-12 19:36:00


On Tue, Oct 12, 2010 at 7:22 PM, Emil Dotchevski
<emil_at_[hidden]> wrote:
> On Tue, Oct 12, 2010 at 4:04 PM, Daniel Walker
> <daniel.j.walker_at_[hidden]> wrote:
>> Formally, boost::function invocation has strong exception safety if
>> invoking the target function has strong exception safety.
>
> This makes no sense at all. Invoking boost::function always has strong
> exception safety guarantee. In no way it can make the state of the
> boost::function object inconsistent, because it does not modify its
> state.

The target function could dereference a null pointer, which would not
only modify the state of boost::function, it would modify the state of
the entire system by bringing it to an abrupt halt. So, to be formal,
a call to boost::function::operator() will only complete successfully
or throw an exception if the target function completes successfully or
throws an exception. However, I think, informally, we can leave it
unspoken but understood that boost::function's behavior depends on the
target function.

Daniel Walker


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