Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-10-24 08:33:39

Marc Duflot wrote:
> g++ 2.95.2
> g++ 3.0.4
> g++ 3.1 and 3.2
> Intel C++ 6.0
> SGI MipsPro Compiler
> Visual C++ 6

Thanks for testing :))

> Summary:
> * g++ 3.0.4: bad
> * g++ 2.95.2 and Visual C++ 6: average: RVO but not NRVO
> * Intel C++ 6.0 and SGI MipsPro Compiler (both based on EDG): good: RVO and
> NRVO except with X x( f() );

The question is, why 'X x( f() );' is different from 'X x = f();'. Is
this a problem in the standard or just some flaw in the compilers? I
guess it's the later but I would feel better is someone with more inside
could have a look at it... especially as the EDG-based compilers have a
very good reputation and proved me wrong more than once :)

> * g++ 3.2: best
> Every compiler outputs nothing for X( f() ) and X( g() ).

This is the most surprising result, at least to me. As all compilers
seem to agree, I wonder if I missed some fundamental point. I would not
expect that compilers are allowed to remove the objects completly. Is it

For boost (as a lame attempt to make it on-topic for this list :) should
we add 'X x = f(); is preferable over 'X x( f() );' to the coding
guidelines? I am personally not very happy with this idea. Or should be
encapsulate it through a macro as we did for BOOST_STATIC_CONSTANT? This
is IMHO even worse... or shall we simply ignore this problem?

Regards, Daniel

Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

Boost list run by bdawes at, gregod at, cpdaniel at, john at