home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!waikato.ac.nz!comp.vuw.ac.nz!kauri.vuw.ac.nz!robertd
- Newsgroups: comp.lang.c++
- Subject: Re: Is it possible to use 'delete this' ?
- Message-ID: <BzqE5s.6Lr@comp.vuw.ac.nz>
- From: robertd@kauri.vuw.ac.nz (Robert Davies)
- Date: Wed, 23 Dec 1992 21:25:04 GMT
- Sender: news@comp.vuw.ac.nz (News Admin)
- References: <Dy93VB2w165w@bwhwob.escape.de> <rmartin.725129268@thor>
- Organization: Victoria University of Wellington
- Nntp-Posting-Host: kauri.vuw.ac.nz
- Lines: 39
-
- rmartin@thor.Rational.COM (Bob Martin) writes:
- >bernd@bwhwob.escape.de (Bernd Wiegmann) writes:
- >
- >>Hi,
- >
- >>Is it possible to use 'delete this' as the last statement in a
- >>method of a class ?
- >
- >In general, "delete this" is a bad idea.
- > .........
-
- This is the standard argument - but I suspect it is not necessarily the
- correct one.
-
- My matrix package newmat06 uses "delete this" in a number of places and this
- is one statement that does not seem to have been a problem.
-
- Newmat06 (with some minor amendments) runs OK on Borland 3.1, Gnu 2.2.2,
- (not sure about 2.3.2) AT&T 2.2, 3.0, Microsoft (7.0), and mostly on
- Zortech so most vendors don't seem to be having a problem. (Gnu 2.3.2 and
- Microsoft won't delete this from a constant member function, but that seems
- very sensible).
-
- This is in contrast with things like multiple inheritance
- and templates that I would be very reluctant to use in a portable package
- at the present time.
-
- I agree that "delete this" could be very confusing in a function likely to
- be used by others (or oneself, sometime in the future), but for a function
- that is only for internal use by one's package, probably declared private
- and properly documented, there doesn't seem to be a problem.
-
- The danger with the statements that "delete this" is not a good idea is
- that the compiler writers or standards committee will listen and a very
- useful construct (in some situations) will be lost.
-
- Robert
-
-
-