Re: Linux-2.4.0-test9-pre2

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sun Sep 17 2000 - 19:25:22 EST


On Mon, 18 Sep 2000, Chris Wedgwood wrote:

> On Sun, Sep 17, 2000 at 10:37:51AM -0700, Linus Torvalds wrote:
>
> - "extern inline" -> "static inline". It doesn't matter right now,
> but it's proactive for future gcc versions.
>
> can someone please explain the difference?

Let's assume that gcc decides that it won't inline a function, because
it's too "big", according to some gcc definition of "big".

With "extern inline", the function will not exist AT ALL, and you'll end
up getting a link-time error complaining about the lack of that function.

With "static inline", gcc will emit the function as a separate function
for that compilation block if it didn't get inlined.

Both are valid things. You use "extern inline" when you have a "backing
store" for the funcion (ie you do have the non-inlined version in a
library somewhere). You use "static inline" when you don't.

For the kernel, we very seldom have the non-inlined versions in any
library, so for the kernel "extern inline" is almost always the wrong
thing.

Note that with most versions of gcc this is all a complete non-issue, as
most versions of gcc will _always_ inline a function that the user has
asked to be inlined. So the issue seldom actually comes up.

                Linus

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



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:15 EST