From 5733224790513819003
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ba46df2c00e31ceb
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2004-02-27 13:05:04 PST
Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: "William M. Miller" <wmm@world.std.com>
Newsgroups: comp.std.c++
Subject: Re: Why no size_t in global operator delete?
Date: Fri, 27 Feb 2004 15:03:40 CST
Organization: Altopia Corp. - Usenet Access - www.altopia.com
Lines: 34
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <c1nlmo$1k0vo2$1@ID-166721.news.uni-berlin.de>
References: <MPG.1aa86999b63db146989733@news.hevanet.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
X-Orig-NNTP-Posting-Host: 144-212-111-151.mathworks.com (144.212.111.151)
X-Orig-X-Trace: news.uni-berlin.de 1077893656 54558466 I 144.212.111.151 ([166721])
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: en-us, en
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=0.0 required=5.2 tests=none autolearn=no 
	version=2.60-mulga_r1
Xref: archiver1.google.com comp.std.c++:1240

Scott Meyers wrote:

> Classes can declare an operator delete that has the runtime system provide
> the size of the just-destructed-object whose memory is being deallocated:
> 
>   void operator delete(void *ptr, size_t sizeOfFormerObject);
> 
> Does anybody know why there is no global operator delete with this same
> signature?  A client of mine claims to have a good reason for wanting to
> know the size of the memory being deallocated by the global operator
> delete, and when he asked me why there was no global version like the class
> version taking a size_t, I found that I had no idea why such a version is
> missing.  Is there a good technical basis for the omission?

The difference is that a class gives you a way of determining 
whether the (void*, size_t) signature is the "usual" deallocation 
function or an overload ("placement") version (3.7.3.2p2).  The 
two-parameter version is only a "usual" deallocation function if 
the class does not declare the single-parameter version.

The global deallocation functions are always declared everywhere 
(with one parameter), so a two-parameter version can only be a 
"placement" deallocation function.

-- 
William M. Miller, The MathWorks, Inc.
wmm@world.std.com

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]



