What does it mean to inline a function and how does it affect a program?


An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. This eliminates call-linkage overhead and can expose significant optimization opportunities. Using the “inline” specifier is only a suggestion to the compiler that an inline expansion can be performed; the compiler is free to ignore the suggestion.


inline is more like static or extern than a directive telling the compiler to inline your functions. externstaticinline are linkage directives, used almost exclusively by the linker, not the compiler.