多语言展示
当前在线:1262今日阅读:179今日分享:36

MISRA C Rule­2.2 2986 2995

操作是多余的,结果永远是操作符右值; 逻辑运算的结果总是'true' 。
工具/原料
1

Rule­2.2 2986 2995

2

MISRA C:2012

Rule­2.2 2986
1

3

2986  This operation is redundant. The value of the result is always that of the right-hand operand.  这个操作是多余的,因为其结果可用操作符右值代替。

4

官方示例

5

编程规范修改举例END

Rule­2.2 2995
1

规则与等级对应关系(QAC)

2

2995  The result of this logical operation is always 'true'.  逻辑运算的结果总是'true'(1)。 这种'退化'运算是代码的一种逻辑缺陷。

3

官方示例

4

编程规范修改举例END

推荐信息