union U {
int a;
short b;
float c;
};
U u;
u.a = 10;
if (u.b == 10) {
// 这是未定义的行为,因为“ a”是最后一个要
//写给。许多编译器会允许这样做,并且可能会发出
// warning, but the result will be "as expected"; this is a compiler
// 扩展名,并且不能跨编译器保证(即,这是
// 不符合/便携式代码)。
}