🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

placement delete

#1987
From: Robert Martin
Date: Mon, 18 Sep 1995 21:31
40 lines
2080 bytes
Question:

It is my understanding from the WP that placement versions of operator
delete are only called when a constructor of a object created by the
corresponding placment new throws an exception.  I have seen this
confirmed by a recent thread in this newsgroup.

That thread also suggested that the only way to explicitly call
placement delete would be to overtly call the appropriate operator
delete.  e.g.

	operator delete (object, arg1, arg2);

Now, as I understand it, such a call will not cause the destructor of
the object to be called.  Thus, of one is to invoke the placement
syntax of operator delete, one must first explicitly call the
destructor.  e.g.

	object->X::~X(); // destruct
        operator delete(object, arg1, arg2); // deallocate

If, in a certain application, placement delete *must* be conjugated
with placement new, then all objects must be separately destructed and
deleted as above; there is no single statement equivalent to
'delete(arg1, arg2) object' that will coordinate the destruction and
deletion.  

Is this correct?  If so, does the committee feel that this represents
a weakness in the language that will be addressed in the standard?
-- 
Robert Martin       | Design Consulting   | Training courses offered:
Object Mentor Assoc.| rmartin@oma.com     |   OOA/D, C++, Advanced OO
2080 Cranbrook Rd.  | Tel: (708) 918-1004 |   Mgt. Overview of OOT
Green Oaks IL 60048 | Fax: (708) 918-1023 | Development Contracts.

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <MATT.95Sep18143159@physics10.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: rmartin@rcmcon.com (Robert Martin)
Newsgroups: comp.std.c++
Subject: placement delete
Date: 18 Sep 1995 21:31:59 GMT
Organization: R. C. M. Consulting Inc. 708-918-1004
Approved: matt@physics10.Berkeley.EDU (Matt Austern)
Message-ID: <MATT.95Sep18143159@physics10.Berkeley.EDU>
NNTP-Posting-Host: physics10.berkeley.edu