🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1733

Is this a bug or a feature?

#1733
From: Ron Guilmette
Date: Wed, 15 Mar 1989 06:21
36 lines
1706 bytes
Now that I can oveload my own per-class new & delete operators,
I just had to see if the delete operator could be made virtual
just like the destructors can.

There seems to be something really fishy about the way you have
to declare delete methods though.  For instance, I assume that
they do implicitly get a this pointer, and that the this pointer
points to the thing to be deleted.  Is that right?

If that is right, then why do you have to declare delete methods
with yet another (explicit) parameter?  The (apparent) need for the
explicit parameter seems to have the side effect of making
virtual delete methods virtually (:-) impossible to use.

Consider the following code which an early g++ 1.34.0 generates
errors for:

--------------------------------------------------------------------------
class base {
	int i;
public:
	virtual void operator delete (base* ptr);
};

class derived : public base {
	int i;
public:
	virtual void operator delete (derived* ptr);	// error ???
};
---------------------------------------------------------------------------

// Ron Guilmette  -  MCC  -  Experimental (parallel) Systems Kit Project
// 3500 West Balcones Center Drive,  Austin, TX  78759  -  (512)338-3740
// ARPA: rfg@mcc.com
// UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg
Technical Details
Message-ID: <8903150621.AA20532@riunite.aca.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg
From: rfg@MCC.COM (Ron Guilmette)
Newsgroups: gnu.g++.bug
Subject: Is this a bug or a feature?
Message-ID: <8903150621.AA20532@riunite.aca.mcc.com>
Date: 15 Mar 89 06:21:55 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 36