A byte is at least large enough to contain any member of the basic
execution character set (2.3) and the eight-bit code units of the
Unicode UTF-8 enCoding form and is composed of a contiguous sequence
of bits,the number of which is implementation defined.
这意味着,一个字节中的位数必须是8位或大于8位.
现在,根据gcc,比特数由ABI确定.
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gcc/Characters-implementation.html#Characters-implementation
4.4字符
字节中的位数(C90 3.4,C99和C11 3.6).
由ABI决定
GCC基于ABI-http://itanium-cxx-abi.github.io/cxx-abi/
有人能指出我提到一个字节中的位数的位置吗?
解决方法 C标准(因此大多数编译器)有效地仅保证char至少为8个连续位.对于任何特定编译,实际位数取决于目标cpu架构.但是,在大多数情况下,您必须非常努力地找到没有8位字节的目标cpu.
如果你必须编写依赖于8位字节假设的代码,那么你总是可以使用static_assert(CHAR_BIT == 8)来防止任何违反你假设的编译.
总结以上是内存溢出为你收集整理的c – GCC编译器的字节数为多少位全部内容,希望文章能够帮你解决c – GCC编译器的字节数为多少位所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)