Named Return Value Extension Proposal

Gabriel Dos Reis Gabriel.Dos-Reis@dptmaths.ens-cachan.fr
Wed Mar 31 23:46:00 GMT 1999


>>>>> «ERT», E Robert Tisdale <edwin@netwood.net> wrote:

> Gaby, You and I will both grow very old and die
> before this compiler catches up with the standard.

Probably. But I don't consider it a reason to make harder the
already painful task of attempting to implement it. Neither a reason to
*require* EGCS developpers to implement a language beside the scope of
ISO C++.

> I don't think that it is too unreasonable for me and other users
> to expect the compiler to produce reasonably fast and efficient code
> without hacking our source to work around a deficient optimizer.

> It appears from the reply by Jason Merrill <jason@cygnus.com>
> to the "elided copy constructors" thread that it will be a very long time
> before the changes can be made to implement the optimizations
> permitted by the standard.  I am simply proposing a stop gap
> to carry us through until it is possible to implement the optimizations.

It will take long time to any compiler to implement optimizations
permitted by ISO C++.

> I have taken some pain to ensure that the proposed extensions
> will not interact badly with the ANSI/ISO C++ standard.
> Please let us know if you see something wrong that I don't see.

Well, as the named return value is an optimization, how can an
application programmer can portably, that is in the scope of ISO C++,
detect whether the compiler is supporting or is going to perform the
named return optimization? He will have to resort to some crippled
extensions. That extension would require lot of work from compiler
writers. 

Given your extension how would the compiler detect that an
application programmer really wanted the NRVO and didn't make a
synatxe error? Ah, the compiler should assume the application
programmer can never make such an error?

Don't get me wrong. I'm highly concerned with optimizations especially
the NRVO; I would be happy to see it in EGCS. But given the state of
the EGCS/g++ compiler, I would like to see work spent on fixing more
fundamental bugs and implementing lacking features (not optimizations).
I don't consider the NRVO as an urgent issue.

You don't have to agree with me, but just accept I have another
opinion on the question.

-- Gaby



More information about the Gcc mailing list