Translation unit
A translation unit is source code produced by preprocessing one source file together with its included contents for compilation.
Modern C
A translation unit is the source code produced after preprocessing one C source file together with its included material and presented to the compiler.
- How it is used
- Uses translation-unit boundaries to explain when compilers can inline functions and optimize across a call.
- How deep it goes
- Explains compiler visibility and optimization consequences, without detailing preprocessing phases or linkage rules.
- Examples
- Uses an inline definition in a header and a matching declaration instantiated in exactly one translation unit.
- What you can do after
- Understand how source inclusion and definition visibility determine the compiler's translation-unit view.
Modern C, Third Edition
A translation unit is the source-code unit produced after preprocessing a C source file and its included contents for compilation.
- How it is used
- Uses translation-unit visibility to explain modular organization and compiler inlining opportunities.
- How deep it goes
- Defines the boundary and explains its optimization consequence, but stops short of detailing preprocessing mechanics or linkage rules.
- Examples
- Uses caller-callee inlining and header-based inline-definition listings, including instantiation in exactly one translation unit.
- What you can do after
- Evaluate when definition visibility can enable inlining and distinguish declarations from definitions across translation units.
Read how Modern C, Third Edition explains translation unit →
What to know first
- calling conventionA calling convention is a set of binary-interface rules specifying how functions receive arguments, return values, preserve state, and manage calls.
- header fileA header file is a source file containing declarations, macros, or other shared interface information intended for inclusion in other source files during compilation.
- pure functionA pure function is a function whose result depends only on its explicit inputs and whose evaluation has no externally observable side effects.
- static methodA static method is a function associated with a type rather than an instance, callable without an instance receiver.
Related concepts
- call graphproduces · A call graph is a directed graph representing possible or observed invocation relationships among functions, procedures, or methods in a program.
- applicationpart of · An application is a software program or system that provides functionality or performs tasks for users or other software.
Questions about translation unit
What is translation unit?
A translation unit is source code produced by preprocessing one source file together with its included contents for compilation.
Which Manning books explain translation unit?
Modern C and Modern C, Third Edition.
What should I know before learning translation unit?
Manning books that teach translation unit usually introduce calling convention, header file, pure function and static method first.
What is translation unit a kind of?
Translation unit is a kind of source file. A source file is a file containing program text written in a programming language for processing by tools such as compilers or interpreters.
What is translation unit part of?
Translation unit is part of application. An application is a software program or system that provides functionality or performs tasks for users or other software.
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.

