From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: delete NULL? Date: Sat, 22 Feb 1997 13:52:13 -0800 Organization: Alcyone Systems Lines: 28 Message-ID: <330F6A8D.643B9308@alcyone.com> References: <19970216 DOT 124451 DOT 7287 DOT 0 DOT fwec AT juno DOT com> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Mark T Logan wrote: > char *ptr = NULL; > > delete ptr; > > Will anything bad happen? I have written the linked list to be as simple > as > possible, and as such only one node will ever have a pointer in it > pointing > to NULL. This node is the dummy node at the beginning of the list, and I > end up calling delete on it in one of my destructors. No. Deleting the null pointer is guaranteed to be safe in C++. > Do I need to avoid this? Will this become some horrific bug much later > in > my project? If it does, then it's a bug in your compiler. -- Erik Max Francis, &tSftDotIotE / email: max AT alcyone DOT com Alcyone Systems / web: http://www.alcyone.com/max/ San Jose, California, United States / icbm: 37 20 07 N 121 53 38 W \ "I am become death, / destroyer of worlds." / J. Robert Oppenheimer (quoting legend)