C 结构体有大小限制吗? [英] Are there any size limitations for C structures?
问题描述
C 结构有大小限制吗?
Are there any size limitations for C structures?
推荐答案
来自 C 标准:
5.2.4.1 翻译限制
1 实现至少应该能够翻译和执行一个程序,其中包含每个程序的至少一个实例以下限制:
1 The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits:
...— 对象中的 65535 字节(仅在托管环境中)
...— 单个结构或联合中的 1023 个成员
...— 单个 63 级嵌套结构或联合定义结构声明列表...13) 实现应该避免强加固定的翻译限制只要有可能.
...
— 65535 bytes in an object (in a hosted environment only)
...
— 1023 members in a single structure or union
...
— 63 levels of nested structure or union definitions in a single
struct-declaration-list
...
13) Implementations should avoid imposing fixed translation limits
whenever possible.
除此之外,上限为SIZE_MAX
(size_t
的最大值).
Other than that, the upper bound is SIZE_MAX
(maximum value for size_t
).
这篇关于C 结构体有大小限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!