Suppose I have a pointer p like this

int *p = new int(0);
*p = 100;
when I try to free the memory, I can do

delete p;

I learned that it safe "delete" a 0 (NULL) pointer, but it's undefined behavior to "delete" a pointer twice. So they told me to always add "p=0;" after deleting p.

Here comes my question:
It seems that we can just add "p=0" into the implementation of the "delete" operator in order to save some typing for coder and it's much safer. But so far it's not the case. So I am wondering why it's not and what's side effect of this addition. Thank you very much.