One Definition Rule (ODR)
(1) In any (single) translation unit, a template, type, function, or object, cannot
have more than one definition
- Compiler error otherwise
- Any number of declarations are allowed
(2) In the entire program, an object or non-inline function cannot have more
than one definition
- Multiple definitions linking error otherwise
- Entities with internal linkage in different translation units are allowed, even if their
names and types are the same
(3) A template, type, or inline functions/variables, can be defined in more than
one translation unit. For a given entity, each definition must be the same
- Undefined behavior otherwise
- Common case: same header included in multiple translation units
31/54