🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Overloading operator delete

#1402
From: Michael Feathers
Date: Wed, 06 Jan 1993 03:20
25 lines
1371 bytes
I discovered the hard way a while ago that the operator delete can not be
overloaded in C++.

I've read the annotation in the ARM and I can not say that I agree with
the reasoning.  One example given for overloading operator new involves using 
another arena for allocation.  But how will this memory be deallocated? 

Doesn't the possibility of using the global delete accidently make the 
absence of an overloadable delete at least as "hazardous" as allowing it?

I understand that there are many applications in which programmers may not
be concerned with reclaiming memory, but aren't there enough to justify being
able to use operator delete symmetrically with operator new without resorting
to the work around discussed in the ARM?

The work around that I've choosen involves using a set of malloc/free type
functions since I have no means of using an overloaded delete symmetrically 
with an overloaded new.

Michael Feathers   [feathers@fiu.edu]



 
Technical Details
Message-ID: <C0Ex9D.Ct7@fiu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!darwin.sura.net!max.fiu.edu!serss0!feathers

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!darwin.sura.net!max.fiu.edu!serss0!feathers
From: feathers@serss0 (Michael Feathers)
Subject: Overloading operator delete
Organization: Florida International University, Miami
Date: Wed, 6 Jan 1993 03:20:00 GMT
Message-ID: <C0Ex9D.Ct7@fiu.edu>
Sender: news@fiu.edu (Usenet Administrator)
Lines: 35