From 4894059156426323
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,2847ea2daacb5072
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2004-04-20 23:15:26 PST
Path: archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.stueberl.de!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: ivr@guesswh.at.emails.ru ("Ioannis Vranos")
Newsgroups: comp.std.c++
Subject: Re: Proposal: free() and delete/delete[] compatibility
Date: Wed, 21 Apr 2004 06:15:23 +0000 (UTC)
Organization: National Technical University of Athens, Greece
Lines: 34
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <c64bnp$icm$1@ulysses.noc.ntua.gr>
References: <c5pk7v$so3$1@ulysses.noc.ntua.gr> <c5po2d$1582$1@ulysses.noc.ntua.gr> <8b42afac.0404190833.18bdf219@posting.google.com> <c61bqe$2k5u$1@ulysses.noc.ntua.gr> <8b42afac.0404200949.74388665@posting.google.com>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1082528123 11163 10.0.0.1 (21 Apr 2004 06:15:23 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 21 Apr 2004 06:15:23 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 1BGB10-0002tl-00
	for mail2news@news.news.demon.net; Wed, 21 Apr 2004 06:15:22 +0000
X-Received: from mulga.cs.mu.OZ.AU (localhost [127.0.0.1]) by mulga.cs.mu.OZ.AU with ESMTP
	id i3L6FIi8016426; Wed, 21 Apr 2004 16:15:20 +1000 (EST)
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i3L5R1Je007240;
	Wed, 21 Apr 2004 15:27:01 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: Tue, 20 Apr 2004 23:28:57 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=0.7 required=5.2 tests=PRIORITY_NO_NAME autolearn=no 
	version=2.60-mulga_r1
Xref: archiver1.google.com comp.std.c++:1804

"James Kuyper" <kuyper@wizard.net> wrote in message
news:8b42afac.0404200949.74388665@posting.google.com...
>
> malloc()/free() is the bookend pair you use when you want to seperate
> dynamic allocation of memory from construction and destruction of
> objects in that memory. new/delete is the bookend pair you use when
> you want to tie allocation/deallocation closely together with
> construction/destruction. Who's responsible for deallocation when you
> use malloc()/delete?
>
> If delete always calls the destructor, than it would have to be an
> error to delete malloc()d memory unless an object of the appropriate
> type has been constructed in-place in that memory. If delete is
> supposed to call the destructor for objects allocated with new, and
> not for objects allocated with malloc(), how is it supposed to know
> which is which? It wouldn't be impossible to implement that, but it
> would require a lot of changes.


My proposal is aimed towards POD types which i forgot to mention.






Ioannis Vranos

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]



