bool取反的一个细节
注意对 bool 变量按位取反永远是 true;
0000 0001
1111 1110
所以用非运算符!代替
bool showGrid; showGrid=!showGrad; //这个才变 showGrid=~showGrad; //不变
注意对 bool 变量按位取反永远是 true;
0000 0001
1111 1110
所以用非运算符!代替
bool showGrid; showGrid=!showGrad; //这个才变 showGrid=~showGrad; //不变