From -630787778285460817
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,f5d433881cc29cff
X-Google-Attributes: gidf78e5,public
From: bparker@gil.com.au (Brian Parker)
Subject: Re: Named return value optimisation- reprise.
Date: 1997/06/24
Message-ID: <33af2ec0.12124987@news.ipswich.gil.com.au>#1/1
X-Deja-AN: 252287575
References: <33a345bf.7425526@news.ipswich.gil.com.au> <33A478C1.329@acm.org> <u9pvtnuemu.fsf@yorick.cygnus.com> <33a5f9a1.5157214@news.ipswich.gil.com.au> <u9k9jsuawy.fsf@yorick.cygnus.com> <33a87d7b.3835586@news.ipswich.gil.com.au> <33a9da21.2670962@news.ipswich.gil.com.au> <01bc7d8a$ffd63b00$2864370a@janeway>
X-Original-Date: Tue, 24 Jun 1997 03:32:08 GMT
Organization: Global Info-Links News Server
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBM7AVQUy4NqrwXLNJAQHDhwH+N1ZoXux0eKv8pE2mZxQCY+HurObRdAs+ wy+nnfcdCWtX61KlxzSbw93FVo8rcw2tYen8AdhB1be1sNs/JSTJ/w== =CqTu
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


On 20 Jun 97 16:53:12 GMT, "Bill Wade" <bill.wade@stoner.com> wrote:

>Brian Parker <bparker@gil.com.au> wrote in article 
>> [deleted]
>> I wonder if a better rewording of 12.8/15 would be to simply add a
>> sentence preventing its use on pass-by-value.
>> 
>> i.e. change 12.8/15 to -
>> 
>> "Whenever a class object [intro.object] is copied via a *copy
>> constructor* and the original object and the copy have the same type,
>> *except on pass-by-value (5.2.2 Function call)* if the implementation
>> can prove ... (rest of wording the same)."
>
[example demonstrating failure of rewording snipped]

>
>It seems that this code is "reasonable" in the absence of the alias
>optimization.  However it doesn't work in the presence of the optimization.
> I don't think changing wording to "function call" helps.  

Yes, my rewording above was flawed- I now think a better rewording
would be to allow the copy to be elided when copying rvalues of the
same type, and lvalues only on function return (to allow the NRVO).

(full wording is in another post in this thread)

,Brian Parker (bparker@gil.com.au)
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



