By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

Is 'delete [] NULL ;' safe ?

P: n/a
Say, ptr=0 / ptr=NULL.

delete ptr; //is safe

// Is
delete [ ] ptr; // also safe ?
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"qazmlp" <qa********@rediffmail.com> wrote in message
news:db**************************@posting.google.c om...
Say, ptr=0 / ptr=NULL.

delete ptr; //is safe

// Is
delete [ ] ptr; // also safe ?


Yes.
--
jb

(replace y with x if you want to reply by e-mail)
Jul 19 '05 #2

P: n/a
On 29 Jul 2003 09:19:43 -0700, qa********@rediffmail.com (qazmlp) wrote:
Say, ptr=0 / ptr=NULL.

delete ptr; //is safe

// Is
delete [ ] ptr; // also safe ?


delete or delete[] of 0 is safe.

NULL may or may not be safe depending on the definition; if it is
the standard NULL from e.g. [cstddef] then yes, that's also safe.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.