Newsgroups: comp.os.msdos.djgpp From: manni DOT heumann AT gmx DOT de (Manni Heumann) Subject: Re: deleting NULL ? References: <8q1u4s$jh3$1 AT info DOT cyf-kr DOT edu DOT pl> <01c02165$667c2780$c3247d81 AT default> X-Newsreader: News Xpress 2.01 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Sun, 17 Sep 2000 11:53:06 GMT NNTP-Posting-Host: ppp36-17.hrz.uni-bielefeld.de Message-ID: <39c4b0a5_1@news.uni-bielefeld.de> X-Trace: 17 Sep 2000 13:53:09 +0200, ppp36-17.hrz.uni-bielefeld.de Lines: 32 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <01c02165$667c2780$c3247d81 AT default>, "doug" wrote: >Rafał Maj 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 > That's right: Invoking delete on a NULL-Pointer simply is supposed to do nothing. See: http://www.slac.stanford. edu/BFROOT/www/Computing/Environment/Standards/C++/cd2/ Sorry for the line break. -- Manni Life would be much easier if I had the source code.