public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vincent Mayeski <mayeski@gmail.com>
To: Eljay Love-Jensen <eljay@adobe.com>
Cc: GCC-help <gcc-help@gcc.gnu.org>
Subject: Re: how to pass params to inline functions by reference or value?
Date: Thu, 10 Apr 2008 15:37:00 -0000	[thread overview]
Message-ID: <1207840269.17629.6.camel@vm-laptop> (raw)
In-Reply-To: <C4238234.3873%eljay@adobe.com>

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
> 

  reply	other threads:[~2008-04-10 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10  5:55 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 [this message]
2008-04-10 21:39         ` Tony Wetmore
2008-04-10 15:33 ` John Fine
2008-04-11 11:57   ` Brian Dessent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1207840269.17629.6.camel@vm-laptop \
    --to=mayeski@gmail.com \
    --cc=eljay@adobe.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).