www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/17/07:45:19

From: "doug" <deleveld AT dds DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: deleting NULL ?
Date: 17 Sep 2000 11:32:38 GMT
Organization: Rijksuniversiteit Groningen
Lines: 16
Message-ID: <01c02165$667c2780$c3247d81@default>
References: <8q1u4s$jh3$1 AT info DOT cyf-kr DOT edu DOT pl>
NNTP-Posting-Host: client36-195.oprit.rug.nl
X-Trace: info.service.rug.nl 969190358 2829 129.125.36.195 (17 Sep 2000 11:32:38 GMT)
X-Complaints-To: newsmaster AT rug DOT nl
NNTP-Posting-Date: 17 Sep 2000 11:32:38 GMT
X-Newsreader: Microsoft Internet News 4.70.1155
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Rafał Maj <r_maj AT poczta DOT onet DOT pl> schreef in artikel
<8q1u4s$jh3$1 AT info DOT cyf-kr DOT edu DOT pl>...
> Hi,
> what is supposed to happen when I'll try delete NULL:
> int* x = NULL;
> delete x;
> Should I every time write   if (x) delete x;    ?

IIRC, the C++ standard says it is legal to delete(0) and it must do
nothing.
To be sure check the C++ faq.  I think it is the same in C, but I am not
sure.
I don't know if DJGPP is compliant for this....

Doug

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019