🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1638

Re: Operator new Question

#1638
From: J. Kanze
Date: Mon, 07 Aug 1995 12:35
22 lines
1383 bytes
Steve Clamage (clamage@Eng.Sun.COM) wrote:

|> The results of using "delete" on a pointer value obtained from a placement-
|> new are undefined. Any result is allowed. It is invalid C++, but no
|> diagnostic is required.

Can this be true?  I always thought that the results of using delete
were to call the destructors, and then call operator delete().  If the
memory was not obtained by calling operator new( size_t ), then the
results are undefined, but in the example given, the memory was obtained
by the placement new calling operator new( size_t ).

Does this mean that I cannot delete memory obtained by:

	p = new ( nothrow() ) T ;

This would sort of make this version of new useless.
-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils en informatique industrielle--
                             --Beratung in industrieller Datenverarbeitung
Technical Details
Message-ID: <4051al$2i8@gabi.gabi-soft.fr>
Path: arc1-ca.pugleaf.net!gabi-soft.fr!not-for-mail
References: <3vu2gv$kav@bmtlh10.bnr.ca> <3vu7te$ql4@engnews2.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gabi-soft.fr!not-for-mail
From: kanze@gabi-soft.fr (J. Kanze)
Newsgroups: comp.std.c++
Subject: Re: Operator new Question
Date: 7 Aug 1995 14:35:33 +0200
Organization: GABI Software, Sarl.
Message-ID: <4051al$2i8@gabi.gabi-soft.fr>
References: <3vu2gv$kav@bmtlh10.bnr.ca> <3vu7te$ql4@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: gabi.gabi-soft.fr
X-Newsreader: TIN [version 1.2 PL2]