This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hello,

I'm trying to decide on the best way to pass parameters to inline
function. For example, the two functions below:

inline int
sum(atype_t *x)
{
  return x->a + x->b;
}

and

inline int
sum(atype_t x)
{
  return x.a + x.b;
}

Since the function is inline, my guess is that the compiler will
generate identical code for both. So there should be no performance
difference.

Is this assumption correct?

V


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]