public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* how to pass params to inline functions by reference or value?
@ 2008-04-10  5:55 VM
  2008-04-10 13:32 ` Ted Byers
  2008-04-10 15:33 ` John Fine
  0 siblings, 2 replies; 9+ messages in thread
From: VM @ 2008-04-10  5:55 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-04-10 21:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-10  5:55 how to pass params to inline functions by reference or value? VM
2008-04-10 13:32 ` Ted Byers
2008-04-10 13:37   ` Vincent Mayeski
2008-04-10 14:45     ` Ted Byers
2008-04-10 15:11     ` Eljay Love-Jensen
2008-04-10 15:37       ` Vincent Mayeski
2008-04-10 21:39         ` Tony Wetmore
2008-04-10 15:33 ` John Fine
2008-04-11 11:57   ` Brian Dessent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).