I have found the following function definition :
static inline __attribute__((always_inline)) int fn(const char *s)
{
return (!s || (*s == '\0'));
}
And I want to know the meaning of inline __attribute__((always_inline))
?
The often referenced gcc
documentation for always_inline
is incomplete.
always_inline
attribute makes gcc
compiler:
-fno-inline
(this is what the documentation says).alloca
calls, which inline
keyword never does.always_inline
.The source of the above information is gcc source code, and, hence, is subject to change with no warning.
An interesting bechmark: always_inline
performance.
It forces the compiler to inline the function even if optimizations are disabled. Check this documentation for more information.