home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13242 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.2 KB  |  47 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!stanford.edu!lucid.com!lucid.com!jss
  3. From: jss@lucid.com (Jerry Schwarz)
  4. Subject: Re: Destruction of temporaries
  5. Message-ID: <1992Sep3.020851.7240@lucid.com>
  6. Sender: usenet@lucid.com
  7. Reply-To: jss@lucid.com (Jerry Schwarz)
  8. Organization: Lucid, Inc.
  9. References: <rmartin.715267769@thor> <1992Sep2.042030.488@frumious.uucp> <1992Sep2.192339.2774@lucid.com> <1992Sep2.223451.24804@tfs.com>
  10. Date: Thu, 3 Sep 92 02:08:51 GMT
  11. Lines: 34
  12.  
  13. In article <1992Sep2.223451.24804@tfs.com>, eric@tfs.com (Eric Smith) writes:
  14. |> In article <1992Sep2.192339.2774@lucid.com> jss@lucid.com (Jerry Schwarz) writes:
  15. |> >    h( ostrstream() ) ;
  16. |> >
  17. |> >but not 
  18. |> >
  19. |> >    h ( ostrstream() << "contents" << ends ) ;
  20. |> 
  21. |> 
  22. |> Wrong.  Both calls are with a temporary.  Both should be equally illegal.
  23.  
  24. I didn't specify h in the original.  I assumed it was obvious
  25. that it would be a function that didn't retain or return it's 
  26. ostrstream& argument.  So I thought h(ostream()) would be ok.
  27. Recall that the argument passing is defined to be equivalent
  28. to initialization so if I can't do the function call, then I
  29. can't do
  30.  
  31.     ostrstream& o = ostrstream() ;
  32.  
  33. either.
  34.  
  35.  
  36. Perhaps Eric will reconsider his comments in that light.  
  37.  
  38.   -- Jerry Schwarz
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.