From -1813443419418561181
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,dfa6d585499f3572,start
X-Google-Attributes: gidf78e5,public
From: "Dave Abrahams" <abrahams@mediaone.net>
Subject: delete (T*)0;
Date: 1999/06/21
Message-ID: <oN6b3.1735$ec.32152@ndnws01.ne.mediaone.net>#1/1
X-Deja-AN: 492295520
Content-Transfer-Encoding: 7bit
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
X-Original-Date: Sun, 20 Jun 1999 10:24:07 -0400
Content-Type: text/plain; charset="US-ASCII"
Organization: Road Runner
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN27FeqwEuYhIxRhxAQFaSwIAhtkj68aHYGDA0ChWeoyrqe4C880jbNHj 3zXWY62ROGpkKlHWfWLZSuqLtuDFTUfyKNSO3QkhC/G/jbyCPlTnmQ== =RRFJ
Mime-Version: 1.0
Newsgroups: comp.std.c++

I'm trying to find out whether, when calling delete on a null pointer value,
the implementation is allowed to call operator delete anyway. I guess that
it is legal for a function which is required to have "no effects" to call
another function which has no effects, and operator delete is not allowed to
have effects when called with a null pointer, so the answer is yes.

Just how strongly is "no effect" indended?

----

  3.7.3.2  Deallocation functions       [basic.stc.dynamic.deallocation]

3 The  value  of  the first argument supplied to one of the deallocation
  functions provided in the standard  library  may  be  a  null  pointer
  value;  if  so,  the  call to the deallocation function has no effect.
  Otherwise, the value supplied to operator delete(void*) in  the  stan-
  dard library shall be one of the values returned by a previous invoca-
  tion of either operator  new(size_t)  or  operator  new(size_t,  const
  std::nothrow_t&)  in  the  standard library, and the value supplied to
  operator delete[](void*) in the standard library shall be one  of  the
  values   returned   by   a  previous  invocation  of  either  operator
  new[](size_t) or operator new[](size_t, const std::nothrow_t&) in  the
  standard library.

  5.3.5  Delete                                            [expr.delete]

2 If the operand has a class type, the operand is converted to a pointer
  type  by calling the above-mentioned conversion function, and the con-
  verted operand is used in  place  of  the  original  operand  for  the
  remainder of this section.  In either alternative, 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              ]



