🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2089

Re: Why not op delete(void* v&,size_t);?

#2089
From: David Vandevoorde
Date: Mon, 02 Oct 1995 16:48
37 lines
2007 bytes
>>>>> "A" == Anil Kumar Vijendran <akv@marsh.cacs.usl.edu> writes:
>>>>> On 01 Oct 1995 05:39:01 GMT, vandevod@cs.rpi.edu (David
A> Vandevoorde) said:
In article <434me4$ov3@citadel.evolving.com>, Todd Blanchard
<tblancha@evolving.com> wrote:
>>> void operator delete(void*,size_t); ...  Nowhere can I find a
>>> rational explanation for why the pointer is not passed as a
>>> void*& (to allow zeroing).  It would provide more flexibility
>>> in memory management schemes.
[...]
David> Wouldn't this cause problems when attempting to delete
David> const pointers?

David> X* const xp = new X; // ...  delete xp; // Or is this
David> illegal anyway? I suspect not.

A> I don't understand how "delete xp" would be true. Because delete takes
A> a void * and how can a X* const be converted to void* const? Is that a
A> standard conversion by any chance? I'd be surprised if it is. 

Note that 8.3.5/3 says:
	" [about cv-qualifiers for parameter types...] Such cv-qualifiers
	  affect only the definition of the parameter within the body of
	  the function. [...]"
and 13.1/3 further confirms that `operator delete(void*, size_t);' is
equivalent to `operator delete(void* const, size_t);'.

I think (not sure) that this would make `delete xp;' above legal. (After
all, parameter passing in C++ is ``by value'' by default.)

	Daveed

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <VANDEVOD.95Oct2120128@avs.cs.rpi.edu>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <9510020800.AA06591@marsh.cacs.usl.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: vandevod@cs.rpi.edu (David Vandevoorde)
Newsgroups: comp.std.c++
Subject: Re: Why not op delete(void* v&,size_t);?
Date: 02 Oct 1995 16:48:11 GMT
Organization: RPI Computer Science
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <VANDEVOD.95Oct2120128@avs.cs.rpi.edu>
References: <9510020800.AA06591@marsh.cacs.usl.edu>
NNTP-Posting-Host: physics2.berkeley.edu