This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Named return values in C++ doesn't work ?
- To: Sylvain Pion <Sylvain dot Pion at sophia dot inria dot fr>
- Subject: Re: Named return values in C++ doesn't work ?
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at dptmaths dot ens-cachan dot fr>
- Date: Wed, 30 Sep 1998 14:08:47 +0200 (MET DST)
- Cc: Mike Stump <mrs at wrs dot com>, egcs at cygnus dot com
- References: <199809291922.MAA13575@kankakee.wrs.com><19980929214757.B8700@rigel.inria.fr>
>>>>> Sylvain Pion <Sylvain.Pion@sophia.inria.fr> wrote:
> On Tue, Sep 29, 1998 at 12:22:57PM -0700, Mike Stump wrote:
>> > Also, it's a pity (as written in the doc) that we can't specify the
>> > exact location of the constructor. Is someone working on
>> > implementing such a feature ?
>>
>> ? I can't guess what you mean.
> The constructor of the returned object must be at the beginning of the
> function (before any code), if you want to use the "named return value"
> extension. But I would like it to be after some instruction.
> Precisely, I refer to the following comment in the gcc doc:
> "The disadvantage of this extension is that you do not control when the
> default constructor for the return value is called: it is always called at the
> beginning."
> However, I'd first like this feature to work (maybe it's my fault, but the
> simple example I gave doesn't work).
Well this optimization is a GNU extension. The Standard does allow it
in a more uniform way. Personnally I think the GNU extension
equivalent should be dropped (or deprecated) in favor of the Standard
version
-- Gaby