struct bb { unsigned enter_water_erred: 1; unsigned drain_erred: 1; unsigned overflow_erred: 1; unsigned door_lock_erred: 1; unsigned rise_temp_erred: 1; unsigned abnormality_temp_erred: 1; unsigned sensor_erred: 1; }; union { unsigned char byte; struct bb bit; }f10;
看到一程序,里面有用这样的表达式: f10.bit.drain_erred = 0; f10.bit.door_lock_erred = 1;
f10.byte = 0; 但是我没找到头文件,因此我定义了上面那样的,请指点一下,我这样定义是否正确,如果正确,有没有更好的定义方法?? 谢谢 |