Not Const Temporaries
Alexandre Oliva
aoliva@redhat.com
Thu May 3 07:54:00 GMT 2001
On May 3, 2001, Philippe Cizaire <pci@silicomp.com> wrote:
> Alexandre Oliva wrote:
>>
>> On May 3, 2001, Philippe Cizaire <pci@silicomp.com> wrote:
>>
>> > It works fine (but it costs me 2 uneeded temporaries that lead to at
>> > least 4 syscalls... snif).
>>
>> Huh? It shouldn't require any additional temporaries. How does the
>> new member function look like?
> in class TKeeper :
> TKeeper &This(void) { return *this; }
I see. The additional member function seems to be preventing the
return-value optimization. I assume you're compiling this with
sufficient optimization to get TKeeped::This)() inlined, right?
Seems like you're going to have to introduce const copy-constructors
to avoid the extra copying.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
More information about the Gcc-help
mailing list