Boost logo

Boost :

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

On Wed, Oct 20, 2010 at 6:04 PM, David Abrahams <dave_at_[hidden]> wrote:
> At Wed, 20 Oct 2010 16:51:50 -0400,
> Daniel Walker wrote:
>> First of all, boost::function can be in an empty state for two
>> reasons: either it has not been assigned a target function or there
>> has been a problem with the internal target management system.
> What kind of problem?  Can you point to code that shows such a problem
> being detected?  Or are you merely saying, "somebody invoked UB
> somewhere and it nulled out the pointer?"  We don't need to support
> the latter.

boost::function clones target function objects. So, there could be a
failure allocating and/or copy-constructing the target. When this
happens, vtable is set to null. You can see an example in operator= on
line 783 of function_template.hpp. There may be other reasons that I'm
not aware of which could lead to vtable being null. In principle,
there is nothing in the current system guaranteeing that vtable is
non-null at any arbitrary point in time.

Daniel Walker

Boost list run by bdawes at, gregod at, cpdaniel at, john at