Subject: Re: [boost] [function] function wrapping with noexceptionsafetyguarantee
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-11-01 23:58:59
On Sat, Oct 30, 2010 at 5:19 PM, Kazutoshi Satoda
> Domagoj Saric wrote:
>> this 'overhead' of a few static pointers is completely insignificant
>> compared to various related code bloat issues...
> That should be true. But unfortunately, the overhead of static pointers
> are actually significant while they are not const, at least for me.
Okay, few questions, why 'require' it to have something, a null
function pointer could be a valid case, just calling it causes UB.
But since it is unsafe anyway, why use the operator() syntax for it,
why not just do something like this (pick one, whatever is
boost::function<void(int)> f = fromSomewhere();
f(1); // current syntax, calls function, but after doing a null check
u(1); // current syntax, throws
f(unsafe_no_throw,1); // possible new syntax, calls function, no null check
u(unsafe_no_throw,1); // possible new syntax, whatever the platform
does when a null pointer is called
f.unsafe_no_throw_call(1); // possible new syntax, possibly another
name, calls function, no null check
u.unsafe_no_throw_call(1); // possible new syntax, possibly another
name, whatever the platform does when a null pointer is called
There are other ways too of course, but yeah, why not just add another
way to call the existing boost::function that calls it without the
null check and without throwing, just with a precondition that it is
not null, instead of testing it internally? That would solve the
issues fine, and it is an 'advanced' feature so why not have an
'advanced' call for it?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk