From: Eljay Love-Jensen <eljay@adobe.com>
To: Vincent Mayeski <mayeski@gmail.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:11:00 -0000 [thread overview]
Message-ID: <C4238234.3873%eljay@adobe.com> (raw)
In-Reply-To: <1207832200.12695.22.camel@vm-laptop>
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
next prev parent reply other threads:[~2008-04-10 13:37 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 [this message]
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
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=C4238234.3873%eljay@adobe.com \
--to=eljay@adobe.com \
--cc=gcc-help@gcc.gnu.org \
--cc=mayeski@gmail.com \
/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).