我想通过宏使用二进制标志,但在以下情况下出现编译器错误:
#define FLAG_A 0x01;
#define FLAG_B 0x02;
int binVal = 0;
binVal = FLAG_A | FLAG_B;
//getting 0x03 here
但编译器以:
error: expected primary-expression before ‘|’ token
试过:
binVal = 0x01 | 0x02; //this does perfectly well.
感谢您提前回复。