Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

delete = NULL?

Started by Enselic Mar 1, 2003 at 5:30 AM 1 replies 250+ views
Original Post
Enselic
Enselic
Since it will take less time to ask the question here than doin a simpletest prog: if I delete an object: delete pObject; does pObject equal NULL after that or do I explicitly have to assign NULL to pObject? thanks for helpin me out
jonnii
jonnii
when you delete an object you should always then assign the pointer to NULL.

delete doesnt do that.
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com
PM
PM
When you delete an object, the pointer to the object is NOT NULL.
You have to do it explicitly, when you need it...

int *p = new int;
delete p;
// p is not NULL
p = NULL;
// p is NULL
PM Times change... Excuse my poor english!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.