home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12632 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  1.8 KB

  1. Path: sparky!uunet!gatech!bloom-beacon!eru.mt.luth.se!hagbard!loglule!jbn
  2. From: jbn@lulea.trab.se (Johan Bengtsson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: destruction of temporaries
  5. Message-ID: <4853@holden.lulea.trab.se>
  6. Date: 20 Aug 92 11:53:42 GMT
  7. References: <23487@alice.att.com>
  8. Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
  9. Lines: 36
  10. X-Newsreader: Tin 1.1 PL4
  11.  
  12. ark@alice.att.com (Andrew Koenig) writes:
  13. : Three reasons:
  14. :     2. Even if you don't want to handle things like the above, you
  15. :        would still need flags that correspond to temporaries created
  16. :        conditionally, particular in ?: expressions.  These flags
  17. :        can potentially impose significant overhead even on people who
  18. :        don't care about when the temporaries are destroyed.
  19.  
  20. As Dag Bruck said in another posting, conditionals could be
  21. given special status, i.e. early destruction always allowed
  22. in conditionals.  Conditionals suck anyway, don't they?
  23.  
  24. :     3. I have heard comments from users who really want temporaries
  25. :        cleaned up early if possible.  Typically they are using linear
  26. :        algrbra packages and write things like this:
  27. :         Matrix D = A * B * C;
  28. :        
  29. :        and do not want the intermediate result A * B to hang around
  30. :        until the end of the block.
  31.  
  32. But isn't that a "quality of implementation" issue?
  33.  
  34. A good compiler should have an option "-Oearly_destroy" to
  35. be used by knowledgeable programmers.  As with some other kinds
  36. of optimizations, this one cannot be guaranteed to be safe for
  37. all code, so must be used with discretion.
  38.  
  39. -- 
  40. --------------------------------------------------------------------------
  41. | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
  42. | jbn@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490              |
  43. --------------------------------------------------------------------------
  44.