I would like to know the rationale behind the fact that delete accepts the null pointer. In C, free accepts the null pointer, but I believe that the rationale is the fact that a malloc(0) can return the NULL pointer and therefore, the NULL pointer can be considered in some way as a valid pointer (to a 0-sized array).
In C++, it seems that new is not allowed to return a NULL pointer. So I am puzzled. Do you have any code that looks better when using that fact that you can call delete on a null pointer ?
François
PS: I am teaching C and C++ and I would like to know if it is useful to teach C++ people that delete works on a null pointer. And if I do, I need to find some exercices where it is useful to do that.