This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C99 and extern inline


>From gcc info:

----
   If you specify both `inline' and `extern' in the function
definition, then the definition is used only for inlining.  In no case
is the function compiled on its own, not even if you refer to its
address explicitly.  Such an address becomes an external reference, as
if you had only declared the function, and had not defined it.
                                                                                
   This combination of `inline' and `extern' has almost the effect of a
macro.  The way to use it is to put a function definition in a header
file with these keywords, and put another copy of the definition
(lacking `inline' and `extern') in a library file.  The definition in
the header file will cause most calls to the function to be inlined.
If any uses of the function remain, they will refer to the single copy
in the library.
                                                                                
   Since GCC eventually will implement ISO C99 semantics for inline
functions, it is best to use `static inline' only to guarantee
compatibility.  (The existing semantics will remain available when
`-std=gnu89' is specified, but eventually the default will be
`-std=gnu99' and that will implement the C99 semantics, though it does
not do so yet.)
---

There are many extern __inline in glibc header files. They won't work
as expected when gcc default to C99. Do we have any plan to support C99
in this regard?


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]