From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-06-28 11:36:39
Daniel Frey wrote:
>"Victor A. Wagner, Jr." wrote:
>>"missed"? Unnamed return value optimization has been around longer.
>>Scott Meyers (I left his books at the office, so I can't quote which)
>>talked at length about why naming the temporary was likely to generate
>>WORSE code on most (at the time he wrote it) compilers.
>It's "More Efficient C++", Item 4.7. Please also read the errata,
>available at Scott's website. I haven't seen a single case where a
>compiler optimized away any of the unnamed return values for all the
>relevant tests (see csc++). I checked this for GCC 2.95.2, GCC 2.95.3,
>GCC 3.0.4, GCC 3.1, TenDRA 4.1.2, KAI CC (1 year ago, don't remember the
>version), Sun's CC and IIRC the HP-compiler (version: see KAI CC).
>Before the GCC 3.1, it made no difference for me as all compilers I know
>of didn't optimized the return value. With GCC 3.1, things changed and
>it was the first time I was able to remove the temporary with standard
>C++. The GCC 2.95.x had a special extension, which allowed something
>similar, but that was not portable. Still I'd like to hear about a
>single compiler that actually performs the RVO for Scott's example...
>(and from the thread in csc++, it isn't clear if it is allowed to be
Can we see real world benchmarks? I've read about this along time ago
but unfortunately I haven't seen any benchmarks yet.
Thanks and Regards,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk