Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-10-22 18:16:46


"David Abrahams" <dave_at_[hidden]> wrote in message
news:uof9mjeo0.fsf_at_boost-consulting.com...
> gcc-2.95.3
> X
> XC
>
> gcc-3.0.4
> XC
> XCC
>
> gcc-3.2:
> X
> X
>
> cwpro7.2:
> XC
> XCC
>
> cwpro8.2
> X
> XC
>
> cwpro8.3:
> X
> X
>
> vc6:
> X
> XC
>
> vc7:
> X
> XC
>
> vc7.1:
> X
> XC
>
> intel C++ 5.0
> XC
> XC
>
> intel-6.0
> XC
> XC
>
> intel 7 beta (no optimization - release mode fails to link):
> XC
> XC

That's way cool, Davem thanks on behalf of everyone.

Conclusions (to my happiness, 100% as I predicted):

1. URVO is much more widespread than NRVO.

2. Who's doing NRVO already has URVO in their pocket: no compiler above does
a better job with the named value than with the unnamed value.

3. Not everybody does URVO.

So a "portable efficiency" hierachy would be:

1. If you want 100% portable efficiency, mojo is the way. See
http://moderncppdesign.com/mojo.

2. If you want largely portable efficiency, use URVO. When you need to
return lvalues, transform them into temporaries as per my previous post or
as per RETURN_LVALUE described in http://moderncppdesign.com/mojo/old.

3. If you don't care about portability, apply your compiler's optimization
by using the exact idioms they favor.

Andrei

--
All new!  THE C++ Seminar: Oct. 28-30 in Vancouver, WA.
http://www.thecppseminar.com/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk