This is not a delete nullpointer error; by definition, he does nothing.
This is usually a bad idea and a trade; to null pointer variables after delete , because the only effect that it can have is to hide the error that causes multiple deletion (with a pointer variable, null, the second deletion will have no effect, and not, for example, crash).
As a rule, zeroing pointers applies, in my opinion, to all other Microsoft: isms, such as Hungarian notation and the widespread use of macros.
This is something that may once have a good justification, but which today, since 2011, has only negative consequences and is used out of pure inertia: the dissemination of the idea of the type that Knut once described for random generators - almost the least possible, popular and then included as the default generator in a wide variety of language implementations and libraries, with most people thinking that widespread use means that it should be at least reasonable.
However, having said that for a person who tends to be ultra-formal pedantic, he might be at least an emotionally satisfying idea for null pointers, for example. a std::vector , after delete . The reason is that the Holy Standard, ISO / IEC 14882, allows the std::vector destructor to do rather unholy things, such as copying pointer values. And in a formal pedantic view, even such copying of invalid pointer values causes Undefined Behavior. Not that this is a practical problem. First of all, I don’t know absolutely no modern platform where copying will have some kind of bad effect, and secondly, so much code depends on standard containers that behave rationally, which they just need: otherwise no one will use such Implementation.
Greetings and hth.
Cheers and hth. - alf
source share