home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!stanford.edu!lucid.com!lucid.com!jss
- From: jss@lucid.com (Jerry Schwarz)
- Subject: Re: Destruction of temporaries
- Message-ID: <1992Sep2.192339.2774@lucid.com>
- Sender: usenet@lucid.com
- Reply-To: jss@lucid.com (Jerry Schwarz)
- Organization: Lucid, Inc.
- References: <rmartin.715101472@thor> <1992Aug29.184025.328@frumious.uucp> <rmartin.715267769@thor> <1992Sep2.042030.488@frumious.uucp>
- Date: Wed, 2 Sep 92 19:23:39 GMT
- Lines: 44
-
- In article <1992Sep2.042030.488@frumious.uucp>, pat@frumious.uucp (Patrick Smith) writes:
- |>
- |> So I think it would be a better idea for the programmer to identify
- |> those functions which can't be called with temporaries as arguments,
- |> instead of those which can. As, for example, in Eric Smith's
- |> proposal upon which I commented in another posting.
-
- Several people have expressed opinions that seem to suggest that
- there are some functions that should be called with temporaries
- and some that shouldn't. I don't have the same intuition.
-
- In particular, I'm assuming that they would designate that the
- first argument of all my insertors as not usable with temporaries.
-
- ostream& operator<<(ostream& out, MyType& mytype) ;
-
- But the description of these is clear. They return their first
- argument. Except that they have a side effect on out they are
- identity functions. So if I have a function, h that accepts
- an ostrstream& I can call
-
- h( ostrstream() ) ;
-
- but not
-
- h ( ostrstream() << "contents" << ends ) ;
-
- This doesn't make much sense to me. It is one of the
- reasons I am strongly opposed to "earliest possible" destruction
- of temporaries.
-
- -- Jerry Schwarz
-
-
-
-
-
-
-
-
-
-
-
-
-