C99/GNU99对inline关键字的处理不同于C89
C99 inline semantics are often misunderstood. The inline specifier serves two purposes:
First, as a compiler hint in case of
static inlineandextern inlinedeclarations. Semantics remain unchanged if you remove the specifier.
Second, in case of raw inline (ie without
staticorextern) to provide an inline definition as an alternative to an external one, which has to be present in a different translation unit. Not providing the external one is undefined behaviour, which will normally manifest as linking failure.
带有static和extern的情况下,
1
2static inline === static
extern inline === extern
否则,和 1
inline === extern
Ref: http://stackoverflow.com/a/16254679