K
kathy
I have a pointer:
MyClass *p = NULL;
p = new MyClass(...);
....
delete p;
After delete p, does p equal NULL(it is in C++ standard?)? How to
decide if p has been deleted?
The reason I asked this question is that in my project, there are many
code/files use the pointer which I need to determine is it is deleted?
Can I use:
if(p != NULL)
delete p;
I guess somewhere p has been deleted, but p still not NULL(possible?),
the above code might cause problem.
MyClass *p = NULL;
p = new MyClass(...);
....
delete p;
After delete p, does p equal NULL(it is in C++ standard?)? How to
decide if p has been deleted?
The reason I asked this question is that in my project, there are many
code/files use the pointer which I need to determine is it is deleted?
Can I use:
if(p != NULL)
delete p;
I guess somewhere p has been deleted, but p still not NULL(possible?),
the above code might cause problem.