home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18500 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.9 KB  |  45 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!usc!sdd.hp.com!cs.utexas.edu!convex!convex!ssimmons
  3. From: ssimmons@convex.com (Steve Simmons)
  4. Subject: >>>>>>>>  Is it possible to use 'delete this' ?
  5. Sender: usenet@news.eng.convex.com (news access account)
  6. Message-ID: <ssimmons.725636801@convex.convex.com>
  7. Date: Tue, 29 Dec 1992 13:46:41 GMT
  8. Nntp-Posting-Host: pixel.convex.com
  9. Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
  10. X-Disclaimer: This message was written by a user at CONVEX Computer
  11.               Corp. The opinions expressed are those of the user and
  12.               not necessarily those of CONVEX.
  13. Lines: 30
  14.  
  15.  
  16. > The problem I had with Bob's first reply was that he didn't answer the
  17. > question: is "delete this" legal.
  18. >
  19. > I would also like to know the answer. It seems to work on all the compilers
  20. > I have access to and I understand that Bjarne uses it. So I guess it is legal,
  21. > but it would be nice to have a reference - or is it something the standards
  22. > committee should explicitly include in the standard.
  23. >
  24. > I think Bob's reply would have been much more helpful if it had started out
  25. > with "yes", "no", or "not clear".
  26. >
  27. > Then it would be appropriate to give a warning. Incidentally, is the warning
  28. > about is causing difficulty to some compilers just a "gut feeling" or are
  29. > there specific examples?
  30. >
  31. > Bob's warning about "delete this" seems to apply to any use of "delete" by
  32. > an entity that didn't do the corresponding "new". Otherwise there is always
  33. > the risk that the "delete" will be applied to something not created by
  34. > "new". Is this another safe programming rule?
  35.  
  36. On page 66 of the ARM, there is an example of why you would want the 
  37. "delete this" capability.  Therefore, it is probably legal.  However, 
  38. the standard does also say that you must be careful not to delete 
  39. a pointer that is not allocated by new.  The resulting behavior is 
  40. undefined (maybe nothing or maybe core dump). 
  41.  
  42. Thank you. 
  43.  
  44.                     Steve Simmons 
  45.