From -2180082822864384708
X-Google-Thread: f78e5,a10702d4a7db0a94
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news2.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!msrn-out!msrn-in!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: "James Kanze" <james.kanze@gmail.com>
Newsgroups: comp.std.c++
Subject: Re: Why no size_t to ::operator delete?
Date: Wed,  3 Jan 2007 09:30:54 CST
Organization: http://groups.google.com
Lines: 45
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <1167821623.133353.92960@h40g2000cwb.googlegroups.com>
References: <1167748819.184487.135760@v33g2000cwv.googlegroups.com>
   <memo.20070102165315.1896C@brangdon.cix.compulink.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1167821628 12085 127.0.0.1 (3 Jan 2007 10:53:48 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 3 Jan 2007 10:53:48 +0000 (UTC)
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: h40g2000cwb.googlegroups.com; posting-host=62.160.54.162;
   posting-account=uN4QgA0AAAC_qk3WofNKjyjXNSBMXL2b
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.csse.unimelb.edu.au id l03AsXbM005978
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Xref: g2news2.google.com comp.std.c++:5241

Dave Harris wrote:
> lgalfaso@gmail.com (Lucas Galfaso) wrote (abridged):
> > Can you please point me to the specific section where it is stated that
> > this is undefined behavior. I am talking about a fundamental type, like
> > int, not a class, not even a POD.

> I don't have the final standard, but in the 1996 draft it's $5.3.5
> [expr.delete]:

>      3. In the first alternative (delete object), if the static type
>      of the operand is different from its dynamic type, the static
>      type shall be a base class of the operand?s dynamic type and
>      the static type shall have a virtual destructor or the behavior
>      is undefined.

That's unchanged in the latest draft (and presumably in all
versions between, including the official standard).

> Also paragraph 2 says that the value deleted must be "a pointer to a
> non-array object created by a new expression". Casting between pointers to
> fundamental types can change their values. It's even possible that
> sizeof(void *) != sizeof(int *). Some platforms represent int pointers
> differently to char pointers and I believe a conforming compiler can keep
> a char heap separate to the int heap.

I don't think so.  What happens if you replace the global
operator delete?  (On the other hand, while the standard says
that you can replace the global operator delete, it doesn't say
how, so presumably, an implementation could require a compiler
option when it is done, and generate different code in that
case.)

--
James Kanze (GABI Software)             email:james.kanze@gmail.com
Conseils en informatique orient�e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34


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



