Inline function
An inline function is a function defined or designated for incorporation at its use site, either syntactically or through compiler substitution, rather than necessarily invoked through an ordinary call.
Modern C
inline is a C function specifier that permits a function definition to be suitable for direct integration into callers without changing its semantics.
- How it is used
- Uses inline functions to expose optimization opportunities and provide type-safe alternatives to suitable function-like macros.
- How deep it goes
- Explains call replacement, definition visibility, header-based instantiation, and the costs of static header functions.
- Examples
- Uses an unsigned square, a header-defined initializer, and a type-generic floating-point minimum.
- What you can do after
- Apply it by defining header-visible functions, arranging an instantiation, and choosing functions over suitable macros.
Modern C, Third Edition
inline is a C function specifier that permits a definition to suggest inline substitution of a function's body at call sites without requiring the compiler to perform that substitution.
- How it is used
- Uses inline functions to expose small function bodies for optimization and provide type-safe alternatives to function-like macros.
- How deep it goes
- Explains call overhead, optimization opportunities, header definitions, and a single-translation-unit instantiation pattern.
- Examples
- Illustrates a header-defined initializer and contrasts a squaring function with a macro that evaluates count() twice.
- What you can do after
- Evaluate whether inline suits a small function and measure any claimed performance improvement.
Kotlin in Action, 2E
An inline function is a Kotlin function whose body can be substituted at its call sites by the compiler and which can declare reified type parameters.
- How it is used
- Enables efficient higher-order helpers and collection operations while permitting non-local returns from their lambdas.
- How deep it goes
- Explains call-site bytecode substitution, lambda restrictions, performance tradeoffs, and reified runtime type checks.
- Examples
- Uses a locking helper, collection filter/map operations, and filterIsInstance on a mixed String and Int list.
- What you can do after
- Apply it via Kotlin inline and reified declarations to design small lambda-taking helpers and runtime type checks.
Grokking Simplicity
A function defined at the place in a program where it is used rather than assigned to a separate name.
- How it is used
- Uses short anonymous callbacks directly with higher-order functions such as map and withLogging.
- How deep it goes
- Defines inline, anonymous, global, and local functions, then demonstrates callbacks and refactoring limits.
- Examples
- Uses customer emails, greetings, logging, and purchase filtering and mapping to demonstrate inline callbacks.
- What you can do after
- Apply inline functions as map callbacks and recognize when naming a function improves reuse and clarity.
Related concepts
- functionkind of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- function-like macroalternative to · A function-like macro is a macro invoked with function-like syntax that accepts token input and expands or transforms it into generated source.
- header fileconfigures · A header file is a source file containing declarations, definitions, macros, or other information intended for inclusion in source files during compilation.
- C99used by · C99 is the ISO standard revision of the C programming language published in 1999.
- filteringincludes · Filtering is the processing of data or items to select, exclude, or transform them according to specified criteria or rules.
- lambdauses · A lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



