AutosarC++17_10-M3.2.4¶
An identifier with external linkage shall have exactly one definition
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
[NDR 3.2(3), Undefined 3.2(5)]
Rationale
It is undefined behaviour if an identifier is used for which multiple definitions exist (in different translation units) or no definition exists at all. With the exception of templates and inline functions, multiple definitions in different translation units are not permitted, even if the definitions are the same.
Example
// file1.cpp
int32_t i = 0;
// file2.cpp
int32_t i = 1; // Non-compliant
Note
For legal reasons, this rule’s description is not part of the public documentation.