linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shriramana Sharma <samjnaa@gmail.com>
To: Glynn Clements <glynn@gclements.plus.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Function pointers to inline functions
Date: Fri, 25 May 2007 10:27:41 +0530	[thread overview]
Message-ID: <46566CC5.6080904@gmail.com> (raw)
In-Reply-To: <17939.60731.269679.612012@cerise.gclements.plus.com>

Glynn Clements wrote:
> If you declare a function as "inline", the compiler will typically add
> a normal definition as well as inlining it. If you declare a function
> as "static inline", the compiler may omit the normal definition.

Would the static keyword in such a case also restrict the visibility of 
that inline function to that file only?

I mean, if I use -fkeep-inline-functions to get the function output in 
the object file, and if the static keyword also meant that the function 
is visible only in the translation unit in which it appears, then 
-fkeep-inline-functions would be rendered useless, since the only 
conceivable (to me) purpose of outputting a run-time callable version of 
an inline function is to make it available to callers from *outside the 
translation unit*, such as a programmer using a library.

(In fact, I think the *only* conceivable use-case would be someone using 
a library since another translation unit in the same project as the one 
containing the inline function can very well use the definition of the 
inline function to directly inline the code into the caller -- why would 
they want a separate runtime callable version in that case? So the only 
valid case is a programmer using a library but not having access to the 
actual definition of an inline function via the API.)

So I presume that when static is used with inline, it does not retain 
its meaning of "local to this translation unit". Am I right?

Shriramana Sharma.


  reply	other threads:[~2007-05-25  4:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 17:09 Function pointers to inline functions Shriramana Sharma
2007-04-04 18:23 ` Glynn Clements
2007-05-25  4:57   ` Shriramana Sharma [this message]
2007-05-25 22:41     ` Glynn Clements
2007-05-29 13:03       ` Shriramana Sharma
2007-06-04  7:08         ` Glynn Clements
2007-05-25  6:02   ` Shriramana Sharma
2007-04-04 18:33 ` Steve Graegert
2007-04-27 17:01   ` Shriramana Sharma
2007-05-04 13:40     ` Glynn Clements
2007-05-25  4:41   ` Shriramana Sharma
2007-05-25 22:45     ` Glynn Clements

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=46566CC5.6080904@gmail.com \
    --to=samjnaa@gmail.com \
    --cc=glynn@gclements.plus.com \
    --cc=linux-c-programming@vger.kernel.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 NNTP newsgroup(s).