C 中的类型有任何保证的最小尺寸吗? [英] Any guaranteed minimum sizes for types in C?
问题描述
您通常可以对数据类型的最小大小做出任何假设吗?
Can you generally make any assumptions about the minimum size of a data type?
我目前阅读的内容:
- 字符:1 个字节
- 短:2 字节
- int:2 Byte,通常为 4 Byte
- 长:4 字节
浮动???双重???
float.h
和 limits.h
中的值是否依赖于系统?
Are the values in float.h
and limits.h
system dependent?
推荐答案
short int
不得大于 int
.int
不能大于 long int
.
A
short int
must not be larger than anint
.
Anint
must not be larger than along int
.
short int
必须至少有 16 位长.int
的长度必须至少为 16 位.long int
必须至少为 32 位长.long long int
必须至少为 64 位长.
A short int
must be at least 16 bits long.
An int
must be at least 16 bits long.
A long int
must be at least 32 bits long.
A long long int
must be at least 64 bits long.
标准并不要求这些尺寸中的任何一个都必须不同.这是完全有效的,例如,如果所有四种类型都是 64 位长.
The standard does not require that any of these sizes be necessarily different. It is perfectly valid, for example, if all four types are 64 bits long.
这篇关于C 中的类型有任何保证的最小尺寸吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!