I like to go one step further. After all of that I set the pointer to null, so if I try and access it later accidently the program will fault. I usually just make a macro for this.Quote:
Originally posted by Sebastiani
BTW, never do:
if(x) //...or if you like, if(x != NULL)
This will ensure that you don't crash the proggie from deleting a NULL pointer...
#define SafeDelete( x ) if( x ) delete x, x = NULL;