MISRA C++:2008 Rule 6-5-3
The loop-counter shall not be modified within condition or statement
描述
规则定义
The loop-counter shall not be modified within condition or statement. 1
理由
for 循环具有用于修改循环计数器的特定语法。代码审查人员期望使用该语法来进行修改。在其他地方修改循环计数器会增加代码的审查难度。
Polyspace 实现
检查项会标记在循环体或循环条件中修改 for 循环计数器的行为(循环条件是用于判断循环是否应终止的条件)。
故障排除
如果您预期会出现违规,而 Polyspace® 未报告该违规,请参阅诊断为何编码规范违规未按预期显示。
检查信息
| 组:声明 |
| 类别:必需 |
版本历史记录
在 R2013b 中推出
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.