home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!ark
- From: ark@alice.att.com (Andrew Koenig)
- Newsgroups: comp.lang.c++
- Subject: Re: complex classes and temporary destruction.
- Message-ID: <23563@alice.att.com>
- Date: 27 Aug 92 14:46:42 GMT
- Article-I.D.: alice.23563
- References: <MCGRANT.92Aug26232410@rascals.stanford.edu>
- Reply-To: ark@alice.UUCP ()
- Organization: AT&T Bell Laboratories, Murray Hill NJ
- Lines: 30
-
- In article <MCGRANT.92Aug26232410@rascals.stanford.edu> mcgrant@rascals.stanford.edu (Michael C. Grant) writes:
-
- > Oh, and that reminds me, if I can't do
-
- > complex a,b,c,d;
- > ...
- > a = b + c*d
-
- > when the ANSI committee finally settles on some temporary destruction
- > standard, then I'm going to be really ticked.
-
- Of course.
-
- Don't worry, the issues under discussion will not affect well-behaved
- programs such as this. The real problems come about when, say, a String
- class has operator const char() that returns a pointer to the internal
- representation of the String. That then raises the problem:
-
- String s, t;
-
- // ...
-
- const char* p = s + t;
-
- and now, the question is when the temporary representing `s + t' is
- destroyed. The point is that destroying that temporary invalidates p,
- so it suddenly becomes an issue of great concern.
- --
- --Andrew Koenig
- ark@europa.att.com
-