Mac OS X 10.4.9 for x86 Source Code
gcc 实现源代码
源代码在线查看: f-22-2-28.c
#include struct sss{ int i1:22; int i2:2; int i3:28; }; static union u{ struct sss sss; unsigned char a[sizeof (struct sss)]; } u; int main (void) { int i; for (i = 0; i < sizeof (struct sss); i++) u.a[i] = 0; u.sss.i1 = 4194303.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i2 = 3.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i3 = 268435455.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); return 0; }