Article View: comp.std.c++
Article #3203Re: delete this
From: Steve Clamage
Date: Fri, 02 Feb 1996 01:23
Date: Fri, 02 Feb 1996 01:23
22 lines
1475 bytes
1475 bytes
In article 5549@hpato.aus.hp.com, Earl Chew <earl@hpato.aus.hp.com> writes: >I believe that `delete this' is "unsafe". > >Does the draft standard say this explicitly? The draft says you must not access a deleted object. If you delete 'this', you can't touch the object or call any functions on it. The draft also says you must not destroy an object twice, and deleting "this" will destroy it once. So, yes, deleting "this" is in general unsafe, since it is harder to make the "no touch" guarantees from inside a member function. You can design a program so that deleting "this" is appropriate, but such programs are not common. --- Steve Clamage, stephen.clamage@eng.sun.com [ 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://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
Technical Details
Message-ID:
<4ernoe$4hh@engnews1.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<31115249.5549@hpato.aus.hp.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: clamage@Eng.sun.com (Steve Clamage) Newsgroups: comp.std.c++ Subject: Re: delete this Date: 2 Feb 1996 01:23:55 GMT Organization: Sun Microsystems Inc. Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4ernoe$4hh@engnews1.Eng.Sun.COM> References: <31115249.5549@hpato.aus.hp.com> Reply-To: clamage@Eng.sun.com NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: taumet.eng.sun.com Content-Length: 681 X-Lines: 18 Originator: clamage@taumet