home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!destroyer!sol.ctr.columbia.edu!eff!world!pkturner
- From: pkturner@world.std.com (Prescott K Turner)
- Subject: Re: destruction of temporaries
- Message-ID: <BszApE.49v@world.std.com>
- Organization: The World Public Access UNIX, Brookline, MA
- References: <46140@sunquest.UUCP>
- Date: Fri, 14 Aug 1992 14:53:38 GMT
- Lines: 24
-
-
- Bill Raves writes:
- > For example, Jim Adcock has suggested
- > (<70784@microsoft.UUCP>) "NEVER rely on unnamed temporaries to do
- > anything...", but this would seem to erode the expressiveness of the
- > language: constructs like "foo(x + y)" and "foo()[i]" would no longer
- > be permissible.
-
- I second Adcock's advice. Actually, those constructs can be made to
- work at the expense of some extra implementation effort, and some
- execution cost. But the cost is not an impediment if it's being compared
- to code which is not portable to the platforms one needs.
-
- What the programmer must beware (in the absence of garbage
- collection) is pointers and references that refer to unnamed objects.
- The standards committee may eventually mandate that these objects
- hang around somewhat longer, but not indefinitely.
- Classes which rely on such pointers entail pitfalls. Late destruction
- of temporaries (as in cfront) reduces but does not eliminate
- the problem.
- --
- Prescott K. Turner, Jr.
- 13 Burning Tree Rd., Natick, Massachusetts USA
- Internet: pkturner@world.std.com
-