测试语句(C语言):
printf("char[%d] char*[%d] s_int[%d] int[%d] u_int[%d] float[%d] double[%d] long[%d] LL[%d] UL[%d]\n",
sizeof(char),sizeof(char *),
sizeof(short int),sizeof(int),sizeof(unsigned int),
sizeof(float),sizeof(double),
sizeof(long),sizeof(long long),sizeof(unsigned long));
结果如下:
CPU类型 输出结果
ia64 char[1] char*[8] s_int[2] int[4] u_int[4] float[4] double[8] long[8] LL[8] UL[8]
x86_64 char[1] char*[8] s_int[2] int[4] u_int[4] float[4] double[8] long[8] LL[8] UL[8]
i686 char[1] char*[4] s_int[2] int[4] u_int[4] float[4] double[8] long[4] LL[8] UL[4]
很明显的比较结果,指针和长整型由4个升为8个字节,可能在做系统移植的时候需要注意。