Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Ron Guilmette
Wed, 15 Mar 1989 06:21
Is this a bug or a feature?
Author: Ron Guilmette
Date: Wed, 15 Mar 1989 06:21
Date: Wed, 15 Mar 1989 06:21
36 lines
1706 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads