...
Allowing too many objects to have external linkage can use up descriptive identifiers, leading to more complicated identifiers, violations of abstraction models, and possible name conflicts with libraries. If the compilation unit implements a data abstraction, it may also expose invocations of private functions from outside the abstraction.
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL15-C | Low | Unlikely | Low | P3 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Astrée |
| global-object-scope | Fully checked | ||||||
CodeSonar |
| LANG.STRUCT.SCOPE.FILE | Scope could be file static | ||||||
| CC2.DCL15 | Fully implemented | |||||||
LDRA tool suite |
| 27 D | Fully implemented | ||||||
Parasoft C/C++test |
|
|
| MISRA-023 | Fully implemented | |||||||
PRQA QA-C |
| 1504 | Fully implemented | ||||||
RuleChecker |
| global-object-scope | Fully checked | ||||||
Splint |
|
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
SEI CERT C++ Coding Standard | VOID DCL15-CPP. Declare file-scope objects or functions that do not need external linkage in an unnamed namespace |
MISRA C:2012 | Rule 8.7 (advisory) |
Bibliography
ISO/IEC 9899:2011 | Subclause 6.2.2, "Linkages of Identifiers" |
...
...