home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12970 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.4 KB

  1. 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
  2. From: ark@alice.att.com (Andrew Koenig)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: complex classes and temporary destruction.
  5. Message-ID: <23563@alice.att.com>
  6. Date: 27 Aug 92 14:46:42 GMT
  7. Article-I.D.: alice.23563
  8. References: <MCGRANT.92Aug26232410@rascals.stanford.edu>
  9. Reply-To: ark@alice.UUCP ()
  10. Organization: AT&T Bell Laboratories, Murray Hill NJ
  11. Lines: 30
  12.  
  13. In article <MCGRANT.92Aug26232410@rascals.stanford.edu> mcgrant@rascals.stanford.edu (Michael C. Grant) writes:
  14.  
  15. > Oh, and that reminds me, if I can't do
  16.  
  17. > complex a,b,c,d;
  18. > ...
  19. > a = b + c*d
  20.  
  21. > when the ANSI committee finally settles on some temporary destruction
  22. > standard, then I'm going to be really ticked.
  23.  
  24. Of course.
  25.  
  26. Don't worry, the issues under discussion will not affect well-behaved
  27. programs such as this.  The real problems come about when, say, a String
  28. class has operator const char() that returns a pointer to the internal
  29. representation of the String.  That then raises the problem:
  30.  
  31.     String s, t;
  32.  
  33.     // ...
  34.  
  35.     const char* p = s + t;
  36.  
  37. and now, the question is when the temporary representing `s + t' is
  38. destroyed.  The point is that destroying that temporary invalidates p,
  39. so it suddenly becomes an issue of great concern.
  40. -- 
  41.                 --Andrew Koenig
  42.                   ark@europa.att.com
  43.