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