A translation unit is the source-code unit produced after preprocessing a C source file together with its included contents. It is a boundary at which the compiler can see definitions and perform context-dependent optimization. section 16.1
Why the boundary matters
If fcaller and fsmall occur in the same translation unit, a capable compiler may replace the call to fsmall with fsmall's body. Seeing the body in the caller's context can expose dead branches, repeated computations, and restricted return values. section 16.1
Keep these distinctions in mind:
- A declaration alone is insufficient for traditional inlining; the compiler needs the function definition visible. section 16.1
- Headers can expose inline definitions, while a function may be instantiated in exactly one translation unit. section 16.1
- Translation units support modular organization by separating interfaces from implementations, while visible definitions can improve optimization. section 16.1
// Inline definition in a header file.
// Function argument names and local variables are visible
// to the preprocessor and must be handled with care.
inline
toto* toto_init(toto* toto_x){
if (toto_x) {
*toto_x = (toto){ };
}
return toto_x;
}
Inspect the inline definition placed in a header, then compare it with the separate one-translation-unit instantiation. section 16.1

