Re: Is extern inline -> static inline OK?

From: H. Peter Anvin
Date: Fri Aug 06 2004 - 17:31:55 EST


Tim Bird wrote:

Thanks!

From what I have read, for either 'extern inline' or 'static inline'
the compiler is free to not inline the code. Is this wrong?

It is my understanding that...
In the 'static inline' case the compiler may create a function in the
local compilation unit. But in the 'extern inline' case an extern
non-inline function must exist. If the compiler decides not to inline
the function, and a non-inline function does not exist, you get a linker
error. Are you saying that, therefore, 'extern inline' functions are
used (without definition of extern non-inline functions to back them)
in order to guarantee that NO non-inline version of the function exists?


Yes; the final link will fail with an undefined symbol if "extern inline" fails to inline.

-=hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/