比较判断R-1-12-1强制

禁止对 boolean 值进行无意义比较

对 bool 值进行无意义比较
test.c
1#include <stdbool.h>
2
3void foo(bool x, bool y)
4{
5 bool b = x > y;
禁止对 boolean 值进行无意义比较 [gjb8114-r-1-12-1]
6 b = x < y;
禁止对 boolean 值进行无意义比较 [gjb8114-r-1-12-1]
7}
对 boolean 值进行合法运算
test.c
1#include <stdbool.h>
2
3void foo(bool x, bool y)
4{
5 bool b = x && !y;
6 b = !x && y;
7 b = x == y;
8 b = x != y;
9}