I always wondered why automatic setting of the pointer to NULL after delete is not part of the standard. If this gets taken care of then many of the crashes due to an invalid pointer would not occur. But having said that I can think of couple of reasons why the standard would have restricted […]
Category: delete-operator
Deleting a pointer to const (T const*)
I have a basic question regarding the const pointers. I am not allowed to call any non-const member functions using a const pointer. However, I am allowed to do this on a const pointer: delete p; This will call the destructor of the class which in essence is a non-const ‘method’. Why is this allowed? […]