Searching something on SO, I stumbled across this question and one of the comments to the most voted answer (the fifth comment to that most voted answer) suggests that del
In my opinion the anti-pattern is not delete p; p = NULL;
, it's assert(this != NULL)
.
I use the anti-pattern as you call it for two reasons - first to enhance the likelyhood that bad code will crash spectacularly without hiding, and second to make the core problem more obvious in debugging. I wouldn't litter my code with assert
s just on the off chance that it might catch something.