声明定义R-1-1-6强制

禁止函数内的 #define 和 #undef 不配对

函数内的 #define 在函数退出前必须有对应 #undef

#define 和 #undef 不配对
test.cpp
1int foo1(void)
2{
3 #define FOO 1
禁止函数内的 #define 和 #undef 不配对 [gjb8114-r-1-1-6]
4 return FOO;
5}
6
7void foo2(void)
8{
9 #undef FOO
禁止函数内的 #define 和 #undef 不配对 [gjb8114-r-1-1-6]
10}
#define 和 #undef 配对
test.cpp
1int foo1(void)
2{
3 #define FOO 1
4 int x = FOO;
5 #undef FOO
6 return x;
7}