Named return values in C++ doesn't work ?

Sylvain Pion Sylvain.Pion@sophia.inria.fr
Tue Sep 29 16:59:00 GMT 1998


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).

-- 
Sylvain



More information about the Gcc mailing list