Use this tag for questions specifically about the effects of the inline keyword, together with the appropriate language tag.
Inline, or inline expansion, is a programming language optimization that inserts the complete body of the function in every place that the function is called. Depending on the programming language, this may be implemented by the compiler, manually or by a keyword.
Historically, in the C and C++ programming languages, an inline function is a function upon which the compiler has been requested to perform inline expansion. In other words, the programmer has requested that the compiler insert the complete body of the function in every place that the function is called, rather than generating code to call the function in the one place it is defined. However, modern compilers usually use their own heuristics and ignore the request. Thus, the inline
keyword is now mostly used for its effects on the One Definition Rule.
Inline expansion is used to eliminate the time overhead when a function is called. It is typically used for functions that execute frequently. It also has a space benefit for very small functions, and is an enabling transformation for other optimizations.