2013年3月17日
摘要: union除了用于节省空间,还有一些其他用法。1.省去位操作 bit masking / bit shiftingtypedef union { struct { unsigned char byte1; unsigned char byte2; unsigned char byte3; unsigned char byte4; } bytes; unsigned int dword;} HWRegister;...HWRegister reg;reg.dword = 0x12345678;reg.bytes.byte3 = 4;typedef union { ... 阅读全文
posted @ 2013-03-17 14:28 chenkkkabc 阅读(439) 评论(0) 推荐(0) 编辑