home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!secapl!Cookie!frank
- From: frank@Cookie.secapl.com (Frank Adams)
- Subject: Re: Destruction of temporaries
- Message-ID: <1992Sep02.231236.168687@Cookie.secapl.com>
- Date: Wed, 02 Sep 1992 23:12:36 GMT
- References: <rmartin.715267769@thor> <1992Sep2.042030.488@frumious.uucp> <1992Sep2.192339.2774@lucid.com>
- Organization: Security APL, Inc.
- Lines: 25
-
- In article <1992Sep2.192339.2774@lucid.com> jss@lucid.com (Jerry Schwarz) writes:
- >In article <1992Sep2.042030.488@frumious.uucp>, pat@frumious.uucp (Patrick Smith) writes:
- >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.
-
- It isn't clear from the prototype. In other words, there is no way for the
- compiler to know it.
-
- I think this is part of a more general problem with functions that return
- their arguments in C++. Consider the problem with the const-ness of the
- return results of functions returning an argument. We have a solution to
- this, sort of, but it isn't very good: it involves making an exception to
- the type checking.
-
- This isn't an answer; just an attempt to redefine the question.
-