MISRA C:2012 Rule 5.9
Identifiers that define objects or functions with internal linkage should be unique
描述
默认 Polyspace® as You Code 分析中反激活了此检查项。请参阅Checkers Deactivated in Polyspace as You Code Analysis (Polyspace Access)。
规则定义
Identifiers that define objects or functions with internal linkage should be unique 1 .
理由
具有内部链接的标识符只能在其声明的翻译单元中访问。这些标识符通常声明为 static。如果这些标识符不唯一,代码可能会变得难以理解并导致意外结果。
Polyspace 实现
Polyspace 标记在所有翻译单元中不唯一的 static 变量名。
故障排除
如果您预期会出现违规,但未看到该违规,请参阅诊断为何编码规范违规未按预期显示。
示例
检查信息
| 组:标识符 |
| 类别:建议 |
| AGC 类别:可读性 |
版本历史记录
在 R2014b 中推出
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.