//keil中默认是不支持匿名结构体的,需要编译指令#pragma anon_unions指名。
#pragma anon_unions
typedef union {
unsigned int num;
struct {
unsigned int nLow :8;
unsigned int nHigh :8;
};
} Test;
void func(void)
{
Test test;
test.num=99;
test.nLow=10;
}