Why doesn’t delete set the pointer to NULL?

Stroustrup himself answers. An excerpt:

C++ explicitly allows an
implementation of delete to zero out
an lvalue operand, and I had hoped
that implementations would do that,
but that idea doesn’t seem to have
become popular with implementers.

But the main issue he raises is that delete’s argument need not be an lvalue.

Leave a Comment