www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/16/17:48:14

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: delete NULL?
Date: Sun, 16 Feb 1997 13:01:52 -0800
Organization: Alcyone Systems
Lines: 21
Message-ID: <330775C0.439E0A61@alcyone.com>
References: <19970216 DOT 124451 DOT 7287 DOT 0 DOT fwec AT juno DOT com> <330767f3 DOT 6557055 AT ursa DOT smsu DOT edu>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tony O'Bryan wrote:

> I've written some small stuff using new and delete with Turbo C++. 
> Deleting a
> NULL pointer caused my program to crash, so I advise checking for NULL
> before
> deleting anything.

The draft standard indicates that deleting a null pointer will have no
effect.  Even if the _Annotated C++ Reference Manual_ reads, "The effect of
applying delete to a pointer not obtained from the new operator without a
placement specification is undefined and usually harmful.  Deleting a point
with the value zero, however, is guaranteed to be harmless" (p. 63).

-- 
        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)

- Raw text -


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