处理数据时该注意的
signed char 保证至少 8 位,int 保证至少 16 位,long 保证至少 32 位,long long 保证至少 64 位。
The only things guaranteed about integer types are:
sizeof(char) == 1sizeof(char) <= sizeof(short)sizeof(short) <= sizeof(int)sizeof(int) <= sizeof(long)sizeof(long) <= sizeof(long long)sizeof(char) * CHAR_BIT >= 8sizeof(short) * CHAR_BIT >= 16sizeof(int) * CHAR_BIT >= 16sizeof(long) * CHAR_BIT >= 32sizeof(long long) * CHAR_BIT >= 64
The other things are implementation defined. Thanks to (4), both long and int can have the same size, but it must be at least 32 bits (thanks to (9)).
references:
http://stackoverflow.com/questions/13398630/why-are-c-int-and-long-types-both-4-bytes

浙公网安备 33010602011771号