home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18363 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.9 KB

  1. Path: sparky!uunet!wupost!waikato.ac.nz!comp.vuw.ac.nz!kauri.vuw.ac.nz!robertd
  2. Newsgroups: comp.lang.c++
  3. Subject: Re: Is it possible to use 'delete this' ?
  4. Message-ID: <BzqE5s.6Lr@comp.vuw.ac.nz>
  5. From: robertd@kauri.vuw.ac.nz (Robert Davies)
  6. Date: Wed, 23 Dec 1992 21:25:04 GMT
  7. Sender: news@comp.vuw.ac.nz (News Admin)
  8. References: <Dy93VB2w165w@bwhwob.escape.de> <rmartin.725129268@thor>
  9. Organization: Victoria University of Wellington
  10. Nntp-Posting-Host: kauri.vuw.ac.nz
  11. Lines: 39
  12.  
  13. rmartin@thor.Rational.COM (Bob Martin) writes:
  14. >bernd@bwhwob.escape.de (Bernd Wiegmann) writes:
  15. >
  16. >>Hi,
  17. >
  18. >>Is it possible to use 'delete this' as the last statement in a
  19. >>method of a class ?
  20. >
  21. >In general, "delete this" is a bad idea.
  22. > .........
  23.  
  24. This is the standard argument - but I suspect it is not necessarily the 
  25. correct one.
  26.  
  27. My matrix package newmat06 uses "delete this" in a number of places and this
  28. is one statement that does not seem to have been a problem.
  29.  
  30. Newmat06 (with some minor amendments) runs OK on Borland 3.1, Gnu 2.2.2,
  31. (not sure about 2.3.2) AT&T 2.2, 3.0, Microsoft (7.0), and mostly on
  32. Zortech so most vendors don't seem to be having a problem. (Gnu 2.3.2 and
  33. Microsoft won't delete this from a constant member function, but that seems
  34. very sensible).
  35.  
  36. This is in contrast with things like multiple inheritance
  37. and templates that I would be very reluctant to use in a portable package
  38. at the present time.
  39.  
  40. I agree that "delete this" could be very confusing in a function likely to
  41. be used by others (or oneself, sometime in the future), but for a function
  42. that is only for internal use by one's package, probably declared private 
  43. and properly documented, there doesn't seem to be a problem.
  44.  
  45. The danger with the statements that "delete this" is not a good idea is 
  46. that the compiler writers or standards committee will listen and a very
  47. useful construct (in some situations) will be lost.
  48.  
  49. Robert
  50.  
  51.  
  52.