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: Gabriel dot Dos-Reis at dptmaths dot ens-cachan dot fr (Gabriel Dos Reis), egcs at cygnus dot com
- Subject: Re: Named return values in C++ doesn't work ?
- From: Jason Merrill <jason at cygnus dot com>
- Date: 01 Oct 1998 03:26:23 -0700
- References: <oremsu1yz1.fsf@araguaia.dcc.unicamp.br> <13842.7830.723604.235841.cygnus.egcs@piano.dptmaths.ens-cachan.fr>
>>>>> Gabriel Dos Reis <Gabriel.Dos-Reis@dptmaths.ens-cachan.fr> writes:
>>>>> Alexandre Oliva <oliva@dcc.unicamp.br> écrit :
>> Sylvain Pion <Sylvain.Pion@sophia.inria.fr> writes:
>>> class C {
>> [...]
>>> C operator+(const C & d) return tmp; {
>> For some reason, it only works for functions defined outside a class
>> body.
>> Anyway, this feature should be deprecated, since the C++ Standard
>> explicitly allows the unnamed return value optimization.
> I agree. Is anyone be considering that optimization?
I've been considering it for a long time. Unfortunately, the compiler
architecture (going straight to RTL) makes it hard, as we assign the
location of variables well before we can tell if they are suitable to be
stuck in the return value slot.
Jason