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

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

 



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