S
S S
Hi
I have some weird question, "It is always said to assign NULL after
delete", i.e.,
delete obj; obj = NULL; // to prevent multiple deletions crash, we
assign NULL to obj
We don't do like this,
if (obj != NULL) { delete obj; obj = NULL;} since NULL check is
already inserted by compiler.
Why don't compiler assign NULL for us? Is keeping deleted pointer is
of any use? I didn't see any.
Thanks
I have some weird question, "It is always said to assign NULL after
delete", i.e.,
delete obj; obj = NULL; // to prevent multiple deletions crash, we
assign NULL to obj
We don't do like this,
if (obj != NULL) { delete obj; obj = NULL;} since NULL check is
already inserted by compiler.
Why don't compiler assign NULL for us? Is keeping deleted pointer is
of any use? I didn't see any.
Thanks