You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
“static inline” means “we have to have this function, if you use it but don't inline it, then make a static version of it in this compilation unit”
“extern inline” means “I actually have an extern for this function, but if you want to inline it, here's the inline-version”.
You must be careful when using inline function in c/cpp, where inside the function there have
a static variable. In this case, if you don't add decorate (extern or static) on the inline
function, you will get warning message when compiling.
It is easy to explain this, because inline function may not be inline depends on the compiler
optimization method and other things, so as linus said, extern inline function will share
the static variable in all the code, but static inline will share it in same compile unit.
You can treat the behavior as function vs static function.