In C++, the definition of NULL is 0
deleting a zero pointer is harmless by definitionhttp://www.stroustrup.com/bs_faq2.html#null
If you mean delete NULL; it's alright.QuoteIn C++, the definition of NULL is 0Quotedeleting a zero pointer is harmless by definitionhttp://www.stroustrup.com/bs_faq2.html#null
http://www.stroustrup.com/bs_faq2.html#delete-zero
No, I thought it was because letting 0 be null would leave ambiguities over whether 0 should be an integer or a pointer in certain situations, e.g. a function has two overloads, one where you can pass a pointer, and the other where you can pass an integer.If you mean delete NULL; it's alright.QuoteIn C++, the definition of NULL is 0Quotedeleting a zero pointer is harmless by definitionhttp://www.stroustrup.com/bs_faq2.html#null
http://www.stroustrup.com/bs_faq2.html#delete-zero
Huh, I didn't know that. But wasn't the point of creating the nullptr keyword in C++11 was because NULL (thus, 0) could be a valid pointer address on some obscure cases and obscure compilers? (for example, pointer to the first virtual method in a vtable, because pointer addresses can be relatives).