Re: Function pointers to inline functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux