home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!ames!pacbell.com!tandem!UB.com!igor!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Newsgroups: comp.lang.c++
- Subject: Re: destruction of temporaries
- Message-ID: <rmartin.714433518@thor>
- Date: 21 Aug 92 21:45:18 GMT
- References: <1992Aug17.073500.24115@ericsson.se> <TMB.92Aug20142610@arolla.idiap.ch> <1992Aug20.190313.3407@lucid.com> <2285@devnull.mpd.tandem.com>
- Sender: news@Rational.COM
- Lines: 31
-
- rgp@mpd.tandem.com (Ramon Pantin) writes:
-
- >I've got a simple (poor man's?) solution to this problem:
-
- > Let the compiler destroy temporaries as soon as it wishes
- > to do so, with the exception of objects for which a member function
- > that has been declared with a new keyword (say "longlived")
- > _might_ have been executed, in which case the object persist
- > until the end of the function (or some other convenient
- > place for destruction).
-
- [...]
-
- >What do you think?
-
-
- I don't favor any technique which makes the destruction of temporaries
- dependent upon decisions made by the programmer. The language is
- already complex enough without that.
-
- In my opinion, temporaries should be deleted as soon as possible. The
- compiler should issue warnings in any situation where a pointer or
- reference to a temporary is stored (and thus may be dangling after the
- destruction of the temporary). I think this is sufficient.
-
-
- --
- Robert Martin Training courses offered in:
- R. C. M. Consulting Object Oriented Analysis
- 2080 Cranbrook Rd. Object Oriented Design
- Green Oaks, Il 60048 (708) 918-1004 C++
-