From -6229210282570276027
X-Google-Thread: f78e5,a10702d4a7db0a94
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.hanau.net!newsfeed.vmunix.org!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: Tue,  2 Jan 2007 19:22:05 GMT
Lines: 31
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <memo.20070102165315.1896C@brangdon.cix.compulink.co.uk>
References: <1167748819.184487.135760@v33g2000cwv.googlegroups.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=unknown-8bit
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1167765731 14827 158.152.254.254 (2 Jan 2007 19:22:11 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 2 Jan 2007 19:22:11 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.csse.unimelb.edu.au id l02JM8iK029534
X-Orig-X-Trace: individual.net 58QLNmLGjFcMOuo5snJxtQMgfV7iGoBeCvmq53nRgUW4WFSo0=
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 l02JM5DM029498;
	Wed, 3 Jan 2007 06:22: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++:5235

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=20
[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=92s dynamic type and
     the static type shall have a virtual destructor or the behavior
     is undefined.

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

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



