Topic: delete[] and NULL
Author: AllanW@my-dejanews.com
Date: 1998/09/17 Raw View
In article <m3pvcypuo9.fsf@skywalker.grs.de>,
Boris Schaefer <sbo@psy.med.uni-muenchen.de> wrote:
>
> Hi,
> Stroustrup 3rd ed says, that delete p has no effect, if p is 0. It
> doesn't say anything about delete[]'ing 0, so my question is, what
> does the standard say on delete[] 0?
On every implementation I've used so far, delete[] 0 has had no effect.
I always assumed that this was standard; IMO it should be.
--
AllanW@my-dejanews.com is a "Spam Magnet" -- never read.
Please reply in USENET only, sorry.
-----=3D=3D Posted via Deja News, The Leader in Internet Discussion =3D=3D=
-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: sbnaran@fermi.ceg.uiuc.edu (Siemel Naran)
Date: 1998/09/17 Raw View
On 14 Sep 1998 16:13:59 GMT, Boris Schaefer <sbo@psy.med.uni-muenchen.de>
wrote:
>Stroustrup 3rd ed says, that delete p has no effect, if p is 0. It
>doesn't say anything about delete[]'ing 0, so my question is, what
>does the standard say on delete[] 0?
It has no effect.
--
----------------------------------
Siemel B. Naran (sbnaran@uiuc.edu)
----------------------------------
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: paul@ra.avid.com (Paul Miller)
Date: 1998/09/17 Raw View
Boris Schaefer <sbo@psy.med.uni-muenchen.de> writes:
>Stroustrup 3rd ed says, that delete p has no effect, if p is 0. It
>doesn't say anything about delete[]'ing 0, so my question is, what
>does the standard say on delete[] 0?
Same thing.
--
Paul T. Miller | paul@elastic.avid.com
Principal Engineer | Opinions expressed here are my own.
Avid Technology, Inc. - Graphics and Effects Software Group
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James Kuyper <kuyper@wizard.net>
Date: 1998/09/17 Raw View
Boris Schaefer wrote:
> Stroustrup 3rd ed says, that delete p has no effect, if p is 0. It
> doesn't say anything about delete[]'ing 0, so my question is, what
> does the standard say on delete[] 0?
In section 5.3.5 it says, about both kinds of delete: "if the value of
the operand of delete is the null pointer the operation has no effect."
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: mborgerd@my-dejanews.com
Date: 1998/09/15 Raw View
In article <m3pvcypuo9.fsf@skywalker.grs.de>,
Boris Schaefer <sbo@psy.med.uni-muenchen.de> wrote:
>
> Hi,
> Stroustrup 3rd ed says, that delete p has no effect, if p is 0. It
> doesn't say anything about delete[]'ing 0, so my question is, what
> does the standard say on delete[] 0?
>
> Thanks for any info.
>
> --
> Boris Schaefer -- sbo@psy.med.uni-muenchen.de
According to draft standard:
18.4.1.2
void operator delete[](void* ptr) throw();
void operator delete[](void* ptr, const std::nothrow_t&) throw();
[snip]
Default behavior:
--For a null value of ptr, does nothing.
--Any other value of ptr shall be a value returned earlier by a call
to the default operator new[](std::size_t).33) For such a non-null
value of ptr, reclaims storage allocated by the earlier call to the
default operator new[].
Mark Borgerding
mborgerding@acm.NOSPAM.org
Sr. Software Developer
Sterling Commerce, Inc.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Boris Schaefer <sbo@psy.med.uni-muenchen.de>
Date: 1998/09/14 Raw View
Hi,
Stroustrup 3rd ed says, that delete p has no effect, if p is 0. It
doesn't say anything about delete[]'ing 0, so my question is, what
does the standard say on delete[] 0?
Thanks for any info.
--
Boris Schaefer -- sbo@psy.med.uni-muenchen.de
A sine curve goes off to infinity, or at least the end of the blackboard.
-- Prof. Steiner
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]