该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
32位机器VC++结果是
短整形short int = 16 位 = 2 字节
整形int = 32 位 = 4 字节
长整形long int = 32 位 = 4 字节
单精度float = 32 位 = 4 字节
双精度double = 64 位 = 8 字节
长整形双精度long double = 64 位 = 8 字节
字符型char = 8 位 = 1 字节
无符号字符型unsigned char = 8 位 = 1 字节
有符号字符型signed char = 8 位 = 1 字节
无符号整形unsigned int = 32 位 = 4 字节
有符号整形signed int = 32 位 = 4 字节
无符号长整形signed long int = 32 位 = 4 字节
在TC2.0中
short int = 16 Bit = 2 Byte
int = 16 Bit = 2 Byte
long int = 32 Bit = 4 Byte
float = 32 Bit = 4 Byte
double = 64 Bit = 8 Byte
long double = 80 Bit = 10 Byte
char = 8 Bit = 1 Byte
unsigned char = 8 Bit = 1 Byte
signed char = 8 Bit = 1 Byte
unsigned int = 16 Bit = 2 Byte
signed int = 16 Bit = 2 Byte
signed long int = 32 Bit = 4 Byte
tc的
long double = 80 Bit = 10 Byte
vc++的
long double = 64 位 = 8 字节
差了2个字节
我总结应该是和编译系统有关,编译系统根据机器定义。
并且编译系统要遵循short int <= int <= long int 吧
大家讨论下这个问题,到底是数据类型(比如int)取值范围是根据编译系统呢,还是根据CPU构架和编译系统呢。