home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zephyr.ens.tek.com!uw-beaver!news.u.washington.edu!usenet.coe.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!dptg!ulysses!allegra!alice!ark
- From: ark@alice.att.com (Andrew Koenig)
- Newsgroups: comp.lang.c++
- Subject: Re: complex classes and temporary destruction.
- Message-ID: <23578@alice.att.com>
- Date: 28 Aug 92 15:33:09 GMT
- References: <MCGRANT.92Aug26232410@rascals.stanford.edu> <23563@alice.att.com> <64821@cup.portal.com>
- Reply-To: ark@alice.UUCP ()
- Organization: AT&T Bell Laboratories, Murray Hill NJ
- Lines: 27
-
- In article <64821@cup.portal.com> Aurelius@cup.portal.com (Mark Christian Barnes) writes:
-
- > Have the temporary "inherit" (for lack of a better word) the
- > storage class of p. If p is an auto variable then 's+t' should
- > be auto too. Destroy p and 's+t' together. If p is static, then
- > perhaps have 's+t' be static as well, onc instance of 's+t'
- > gets re-used each time the statement is executed.
-
- I'm afraid that wouldn't work. Consider this:
-
- char* I(char* x) { return x; }
-
- The function I (for identity) just returns its argument, but to make things
- difficult, it is compiled separately. Now, you would like
-
- char* p = s+t;
-
- to cause the temporary for s+t to stick around as long as p does,
- but what are you going to do about this?
-
- char* p = I(s+t);
-
- There's no way to know what I() does, so what basis do you have for
- letting the lifetime of p affect that of s+t?
- --
- --Andrew Koenig
- ark@europa.att.com
-