Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xtreme

Delete [] operator

This topic is 6333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

when a delete operator is called to some variable, does that variable get assigned to NULL? For Example: delete [] buffer; frees up the memory held by buffer. So is buffer now assigned to NULL? It seems like in Windows 98/Me it works ok but in Windows NT 4.0 I get an "Access Violation" error whenver I checked for a NULL against the variable after I delete it.

Share this post


Link to post
Share on other sites
Advertisement
Since i didn''t get any run-time errors in Windows Me I left it out. But when I tried it on the Windows NT system, I got the
error!

Share this post


Link to post
Share on other sites
delete does not reset the variable to NULL. It is good practice to do it yourself though since a common cause of bugs is using a pointer after you''ve deleted it.

-Mike

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!