Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!samsung!usc!ucsd!ucbvax!agate!eos!shelby!neon!pescadero.Stanford.EDU!philip From: philip@pescadero.Stanford.EDU (Philip Machanick) Newsgroups: comp.lang.c++ Subject: Re: Overloaded operator new VS. inheritance Message-ID: <1991Jan10.224933.7518@Neon.Stanford.EDU> Date: 10 Jan 91 22:49:33 GMT References: <1991Jan10.195541.6003@usenet@scion.CS.ORST.EDU> Sender: news@Neon.Stanford.EDU (USENET News System) Reply-To: philip@pescadero.stanford.edu Organization: Computer Science Department, Stanford University Lines: 19 In article <1991Jan10.195541.6003@usenet@scion.CS.ORST.EDU>, keffert@jacobs.cs.orst.edu (Thomas Keffer) writes: |> I've been using overloaded new and delete operators |> to implement a "small object pool" to speed the |> allocation and deallocation of small objects from the heap. |> I have been running into problems with inheritance and want to |> propose a simple language extension to deal with the problem. |> Here's an example: [example deleted] [why passing size to delete would be useful] |> An easy solution to the problem would be to have Small::operator |> delete pass the size of the object --- it's known at the point of |> call, even for objects with virtual destructors. ARM p 283: this feature is already available. You can either have operator delete with one argument (void*) or two (void*, size_t). -- Philip Machanick philip@pescadero.stanford.edu