From -5262729570037128366
X-Google-Thread: f78e5,a10702d4a7db0a94
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news2.google.com!news1.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: tommi.hoynalanmaa@iki.fi (=?ISO-8859-1?Q?Tommi_H=F6yn=E4l=E4nmaa?=)
Newsgroups: comp.std.c++
Subject: Re: Why no size_t to ::operator delete?
Date: Tue, 26 Dec 2006 19:03:02 GMT
Organization: Saunalahti Customer
Lines: 33
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <oR5kh.9335$VN4.8290@reader1.news.saunalahti.fi>
References: <12omt8jit7rl379@corp.supernews.com> <Fe2dna0ZAa0PdxHYnZ2dnUVZ_rylnZ2d@giganews.com> <12or0p6oph82af5@corp.supernews.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: quoted-printable
X-Trace: news.demon.co.uk 1167159791 19198 158.152.254.254 (26 Dec 2006 19:03:11 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 26 Dec 2006 19:03:11 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Thunderbird 1.5.0.8 (X11/20061117)
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.csse.unimelb.edu.au id kBQJ382C005673
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 kBQJ32Hx005643;
	Wed, 27 Dec 2006 06:03:02 +1100 (EST)
X-NNTP-Posting-Date: Tue, 26 Dec 2006 11:22:28 EET
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++:5173

Scott Meyers kirjoitti:
>=20
> I don't see how it's any more error-prone than the class-specific=20
> version of operator delete that takes a size.
>=20

Suppose we a pointer to some base class A and it actually points to an=20
object of derived class B that inherits from A:
---
A* a =3D new B;
delete a;
---
Suppose that A has a virtual destructor.
Then a class-specific delete operator in A with a size_t argument always=20
gets the correct size of the object to be deleted (sizeof (B) in this cas=
e).

If we had a size_t argument in the global delete operator it would=20
probably get sizeof(A) in the example above. However, it might be=20
possible to pass the correct runtime size of objects to global operator=20
delete for classes having virtual destructors.

--=20
Tommi H=F6yn=E4l=E4nmaa
s=E4hk=F6posti / e-mail: tommi.hoynalanmaa@iki.fi
kotisivu / homepage: http://www.iki.fi/tohoyn/

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



