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