🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: operator delete modifying pointers?

#863
From: William M Miller
Date: Tue, 26 Feb 1991 01:57
18 lines
1536 bytes
jimad@microsoft.UUCP (Jim ADCOCK) writes:
>        shouldn't overloaded operator deletes also support a first parameter
> of reference-to-void-pointer, so that programmers can implement their own
> operator deletes that change pointers to null [or some other value]
> as a side-effect of deleting via that pointer?

That's an interesting thought.  It's not quite that simple, though, since a
typed pointer is not compatible with a void*& and, in general, can't be.  On
some architectures, the representation of an address as a void* is different
from the representation of that same address expressed as a pointer to some
other data type.  In order to implement your suggestion, it would require
that all pointers be required to have the void* representation and would
introduce an implicit cast of the operand of "delete" to void*& before
invoking the operator delete().  The latter is just a definitional thing,
but the former could have significant performance impact.

-- William M. Miller, Glockenspiel, Ltd.
   wmm@world.std.com
Technical Details
Message-ID: <1991Feb26.015730.15749@world.std.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!ubc-cs!uw-beaver!mit-eddie!bloom-beacon!deccrl!decwrl!world!wmm
References: <70879@microsoft.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!ubc-cs!uw-beaver!mit-eddie!bloom-beacon!deccrl!decwrl!world!wmm
From: wmm@world.std.com (William M Miller)
Newsgroups: comp.std.c++
Subject: Re: operator delete modifying pointers?
Message-ID: <1991Feb26.015730.15749@world.std.com>
Date: 26 Feb 91 01:57:30 GMT
References: <70879@microsoft.UUCP>
Organization: The World Public Access UNIX, Brookline, MA
Lines: 18