I am very perplexed about the difference between:
static __inline__ int func1() and
extern __inline__ int func2()
Pls delete this post if same questions have been posted before here,I am very sorry that I don't know how to use the search function of this board
what's the intrinsical difference between them?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:what's the intrinsical difference between them?
static __inline__function() {...} just means that the function will not be viewable for outer modules (in the linker way of the word, i.e. other .o files). This has two usages:
though i dunno whether __inline__ F(type1, type2); would have given the same result or not, but i fear the compiler would have issued a "globally-viewable symbol F()" in that case.
- as the function is only seen within its own module, it can be declared in many modules, which is mandatory for an inline function
- if no instruction of the current module request the *address* of the function (but just call it), and if every function call have been inlined by the compiler, then there is no code emitted for the inline function itself (and there is no need for emitting it
Code: Select all
extern __inline__ F(type1, type2);
// some code that calls F(type1, type2)
static __inline__ F(type1, type2) {
...
}