Boost logo

Boost :

From: Jesse Jones (jejones_at_[hidden])
Date: 2000-11-17 20:44:28


>>> > The Functor implementation class is the only essential class. The
>> > otherwise were included because I believed them to enhance type and
>> > runtime safety (e.g., a NULL function pointer will never be called).
>> > These concerns can be addressed in other places, but I think it
>> would
>> > be a mistake to allow a user to pass a NULL function pointer and
>> then
>> > have the callback code dereference it.
>>
>> This kind of safety should really be addressed by the code that
>> implements the functors.
>
>What should a functor do, then, if it gets a NULL pointer? The options
>I currently see are:
> 1) Immediatly throw an exception.
> 2) Throw an exception when the function call operation is
> invoked.
> 3) Don't dereference, but don't complain.

4) Constructing a callback with a NULL function pointer is a precondition
violation. Ideally an assert would fire or an exception would be thrown.
IMO the exact behavior is a policy decision that client programmers should
be able to affect and it's something that needs to be addressed in boost as
a whole.

  -- Jesse


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