글
Technical Article/펌 2004. 2. 10. 14:18C++ delete쓸때 NULL체크 하지말자!!!
[16.7] Do I need to check for NULL before delete p?
No!
The C++ language guarantees that delete p will do nothing if p is equal to NULL. Since you might get the test backwards, and since most testing methodologies force you to explicitly test every branch point, you should not put in the redundant if test.
Wrong:
if (p != NULL)
delete p;
Right:
delete p;
http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.7
No!
The C++ language guarantees that delete p will do nothing if p is equal to NULL. Since you might get the test backwards, and since most testing methodologies force you to explicitly test every branch point, you should not put in the redundant if test.
Wrong:
if (p != NULL)
delete p;
Right:
delete p;
http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.7

RECENT COMMENT