From: JonY <10...@gm...> - 2008-10-13 07:53:46
|
On 10/13/2008 11:18, Brian Dessent wrote: > Roumen Petrov wrote: > >> If I omit extern from function declaration it is fine. > > "extern inline" on a definition tells gcc to use that definition only > for the purposes of inlining, but never emit and out-of-line copy of the > function body. Plain "inline" both emits an out-of-line copy and uses > the definition for inlining. > > Thus when you say "extern inline" what you are saying is "this is a > version of the function that you should use for any call site where it > can be inlined, but there is a separate callable library version of the > function elsewhere." But if there is no separate library version > elsewhere then any callsite that couldn't be inlined will fail -- and > note that gcc does no inlining without optimization enabled (-O), so you > really can't use "extern inline" alone in a header without a > corresponding library function somewhere. > Also, how gcc handles the {extern,static} inline keywords depends on whether it was set to C99 or C89 mode. More here: <http://gcc.gnu.org/ml/gcc/2006-11/msg00006.html> |