From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-11-03 20:02:39


Mike Tegtmeyer wrote:
> I agree but it quickly becomes a pain because you end up writing a
> wrapper for every thing of this type to satisfy this 'wart' with
> shared_ptr:
>
> pthread_create ...
> opendir
> fopen
> open
> free
> COM objects
>
> the list goes on.
>
> I guess if shared_ptr was to be done all over again, I think that I
> would argue that it should act like a pointer, ie you shouldn't be
> able to 'delete' a 'null' pointer...
>
> <snip>
>

You lost me there.

It's perfectly fine to delete a null pointer.

5.3.5/2 says

"if the value of the operand of delete is the null pointer the operation
has no effect."

Thanks,

Michael Marcin