运算处理R-1-6-3强制

禁止将赋值语句作为逻辑表达式

if 语句中的赋值语句
test.c
1#include <stdio.h>
2
3void foo(void)
4{
5 FILE *fp;
6 if (fp = fopen("test.txt", "r"))
禁止将赋值语句作为逻辑表达式 [gjb8114-r-1-6-3]
7 {
8 }
9}
if 语句中隐式转换的逻辑表达式
test.c
1#include <stdio.h>
2
3void foo(void)
4{
5 FILE *fp = fopen("test.txt", "r");
6 if (fp)
7 {
8 }
9}