From 9162281108462089644
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8017beb93f8fbefc
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-06-12 14:07:01 PST
Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!newsfeed.icl.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: "Igor A. Goussarov" <igusarov@akella.com>
Newsgroups: comp.std.c++
Subject: Re: Incomplete types
Date: Tue, 12 Jun 2001 21:06:32 GMT
Organization: Akella
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3B26648E.39F5202@akella.com>
References: <3B250752.99C15516@akella.com> <3B253155.D66B49E5@spamcop.net>
X-Trace: mail2news.demon.co.uk 992379998 mail2news:13152 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
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)
X-Accept-Language: ru,en
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 42
Xref: archiver1.google.com comp.std.c++:5990

Ron Natalie wrote:
> 
> "Igor A. Goussarov" wrote:
> 
> >
> >    Sorry, I didn't make myself clear enough. Deleting something is a
> > two-step process. First, an object is destroyed. Second, the memory
> > allocated for that object is freed. Destroying a builtin type is a
> > no-op. Thus deleting an int, char, double, pointer or any other 'simple'
> > type is effectively the same as freeing up the memory. That's why I said
> > that deleting something via void* can be tolerated, but an explicit cast
> > to void* should be required as a sign that a programmer knows what he is
> > doing.
> 
> You've lost me.  Why does a cast to void* indicate that the programmer
> knows what he is doing.  If he knew what he was doing, the pointer would
> be properly declared.  These 'simple types' are always complete anyhow.

   Let's start again. The current Standard doesn't forbid a deletion of
an incomplete type. Such action is currently described as 'undefined
behaviour'. This seems to be plain wrong because this is a very likely
error. So (IMO) it should be made a compile-time error.
   So let's imagine it is made an error. But since the deletion of an
incomplete type was allowed up to now, there should be a way (kinda
'backward compatibility') of doing such deletion asif it is still
allowed (however I can't imagine a program that rely on this deletion
with undefined behaviour, so maybe this is not that necessary).
   And what I was proposing is:
1) Make the deletion of an incomplete type an error.
2) Leave some way to do this obscure deletion 'old style'.
   One of the possible ways of achieving 2) is allowing this obscure
deletion via explicit cast to void*. If you think that 2) should not be
allowed at all then well, I can understand you.

Igor

---
[ 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.research.att.com/~austern/csc/faq.html                ]



