This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 3.0.1 & C++ ABI issues
Gabriel Dos Reis wrote:
> | IMO, optimizing this case is not important anyway; who passes complex
> | objects by value?
>
> Numericists :-) (Note also that B. Stroustrup in TC++PL3 encourages
> passing by value object of concrete classes such as complex<>).
> Passing "small" objects such as complex<> by value is seen to be
> superior to passing by const reference.
Yes. Way back I did some experiments after implementing a class library
to cope with multimedia data types (packing two 32 bit ints into a 64
bit object & stuff). These were all pass-by-value, and slotted into
a register. Now I wasn't using a kosher C++ compiler at the time, but
I found that the biggest win by *far* was the NRVO. It basically
allowed the compiler to crush out loads of stuff after inlining. I'll
see if I can dig out the results I had. It may be that the std disallows
some of the optimizations I was doing.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org