Re: how to pass params to inline functions by reference or value?

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

 



Thanks everyone,

I'm looking at this purely from a performance point of view. I just want
the version that is faster. I'm assuming the context of C, and that the
function does indeed get inlined.

The .s files are indeed different. Unfortunately I don't know assembler
well enough to tell what the difference is.

I'm using the -S flag. Is there a better way to map assembler code back
to C source?


On Thu, 2008-04-10 at 08:37 -0500, Eljay Love-Jensen wrote:
> Hi Vincent,
> 
> > However, IF the function is inlined, no copying should actually take
> > place because the arg is not modified within the function. My guess is
> > that [#1] these will produce identical code.

> 
> Is the context C++ or C?
> 
> For C++, that [#1] is incorrect for non-regular types, and likely incorrect
> for regular types.  (But for C++ you probably should use a const& for the
> inline function's parm, which would do what you want.)
> 
> For C, I'm not sure, but I suspect that [#1] is incorrect.
> 
> What happens when you test compile the two variants with --save-temps and
> -O2, and look at the resulting .s files?
> 
> HTH,
> --Eljay
> 


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux