From -873294080826615363
X-Google-Thread: f78e5,a10702d4a7db0a94
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news4.google.com!news.glorb.com!peer1.news.newnet.co.uk!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: usenet@aristeia.com (Scott Meyers)
Newsgroups: comp.std.c++
Subject: Re: Why no size_t to ::operator delete?
Date: Sun, 24 Dec 2006 23:43:42 GMT
Organization: Posted via Supernews, http://www.supernews.com
Lines: 33
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <12otles4sq2cd5@corp.supernews.com>
References: <12omt8jit7rl379@corp.supernews.com> <1166902231.099609.61900@h40g2000cwb.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1167003831 19013 158.152.254.254 (24 Dec 2006 23:43:51 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sun, 24 Dec 2006 23:43:51 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.8+Sun/8.13.8/Submit) id kBONhg8D007432;
	Mon, 25 Dec 2006 10:43:42 +1100 (EST)
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++:5164

wkaras@yahoo.com wrote:
> Could they not write a template to call their stack alloc func,
> placement new, and another template to explicitly call
> desctructor, stack free func?

Sure, but they'd have to explicitly pass the size, which they would not 
have to do if the compiler would pass it for them.  The interesting 
issue here is that this feature already exists for class-specific 
operator delete, so the question is why it doesn't or should also exist 
for global operator delete.

>> Can someone explain to me why having the "normal" operator delete take a
>> size_t is impractical?
> 
> I think for this to make sense the delete [] operator would have to be
> change
> to require the dimension of the array, which I think I read in some
> book
> by Dr. Stroustrup was considered but rejected.

The delete operator already has to have access to the number of elements 
in an array, at least for types with nontrivial destructors, so it could 
pass it through to operator delete, but I agree, the situation for 
operator delete[] is probably more complicated than for operator delete.

Scott

---
[ 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                      ]



