I'm pretty sure that doing:

Code:
delete NULL;
is perfectly safe, and is just a no-op. Yet everywhere I look, I keep seeing code like this:

Code:
int* ptr;
...
if (ptr)
{
   delete ptr;
}
WHY? The if guard isn't necessary, right? (Obviously it's good practice to assign a pointer to NULL after deleting it, but there's still no point in the if statement.) So why do people keep doing this? Is it still considered good practice (if so, why?), or is it simply the case that most C++ programmers think that deleting NULL is undefined?

Just