
On Sat, Oct 30, 2010 at 5:19 PM, Kazutoshi Satoda <k_satoda@f2.dion.ne.jp> wrote:
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 'prettier'): boost::function<void(int)> f = fromSomewhere(); boost::function<void(int)> u; 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?