From 8782690264332585113
X-Google-Thread: f78e5,a10702d4a7db0a94
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news2.google.com!news3.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!emea.uu.net!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: brangdon@cix.co.uk (Dave Harris)
Newsgroups: comp.std.c++
Subject: Re: Why no size_t to ::operator delete?
Date: Mon,  8 Jan 2007 17:51:05 GMT
Lines: 32
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <memo.20070107181701.2728A@brangdon.cix.compulink.co.uk>
References: <12pu12q67i8oob6@corp.supernews.com>
NNTP-Posting-Host: news.news.demon.net
X-Trace: news.demon.co.uk 1168278683 2110 158.152.254.254 (8 Jan 2007 17:51:23 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 8 Jan 2007 17:51:23 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Orig-X-Trace: individual.net tPvR0WL4FHzvnzYq+fN36whYwpIlOJnidIZq7Hdch3lmJ9Hx4=
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Reply-To: brangdon@cix.co.uk
X-Originating-IP: 130.133.1.2
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.8+Sun/8.13.8/Submit) id l08Hp52n017210;
	Tue, 9 Jan 2007 04:51:05 +1100 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:5286

usenet@aristeia.com (Scott Meyers) wrote (abridged):
> I'm not a compiler writer, but I'd expect the most-derived destructor 
> to call operator delete.

I'm not one either. The one time I looked at it, the operator delete() was 
being invoked by the base class. I presumed that was because the derived 
class didn't know if it was the /most/ derived class, and so that the 
deletion code could be shared between all of the derived classes.

Anyway, it does affect the main point. Even if the overhead is a single 
machine code instruction that loads a constant, it's still a cost that 
brings no benefit to programs that doesn't use the size.

Incidently, what did you have in mind for the implementation to do in the 
cases where the size is unknown and 0 passed? I'm thinking especially of 
code like:

    struct Pod;
    void kill( Pod *p ) {
        delete p; // Pod is an incomplete type here.
    }

which can be well-defined behaviour. Would this just be a memory leak? 

-- Dave Harris, Nottingham, UK.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



