bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Named return value optimization


From: Eray Ozkural
Subject: Named return value optimization
Date: Wed, 21 Feb 2001 18:36:02 +0200

In C++ Primer sect. 14.8 the optimization (return value) is discussed. [*]

I would like to learn how this optimization can be implemented in g++.

The author of g++ actually proposed the named return value, and the gcc
info docs still talk about it. So I'd like to know whether the g++ team
has implemented the optimization. Perhaps you are planning to do so but
current g++ doesn't seem to have it. Instead g++ still implements the
non-standard language extension but I don't think anyone would want to make
his programs dependent on g++. I have been amazed by not finding this
optimization in g++.

I think that the named return value optimization is a great efficiency
and design aid while programming at large, so I'd be very pleased for any
comments on it.


Regards,


[*] The optimization is that the returned object does not cause any
temporary objects (directly used) as in:

    B b;
    A a = b.method();

where B::method() is implemented as:

A B::method()
{
    A return_value;

    ...

    return return_value;
}

-- 
Eray (exa) Ozkural
Comp. Sci. Dept., Bilkent University, Ankara
e-mail: address@hidden
www: http://www.cs.bilkent.edu.tr/~erayo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]