本文介绍了stdint的int8_t可以存在于没有8位字节的体系结构上吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,有些架构没有8位字节.

这种结构似乎会排除int8_t(在stdint.h中定义)类型的存在,因为根据我的理解,C无法创建小于CHAR_BIT的数据类型.

It would seem that such architectures would preclude the existence of an int8_t (defined in stdint.h) type since C, from my understanding, cannot create datatypes smaller than a CHAR_BIT.

也就是说, IEEE stdint.h定义似乎要求这种类型(以及其他类型)必须存在,只允许在不支持该类型的体系结构上不存在64位.

That said, the IEEE stdint.h def seems to require that such a type exist (along with others), only allowing for the 64-bit to not exist on architectures that do not support it.

我想念什么吗?

推荐答案

正如@JasonD在下面的注释中指出的那样,链接页面的末尾表示状态.

As @JasonD points out in the comments below, the linked page states at the end;

  • 一个字节正好是8位.

  • A byte is exactly 8 bits.

{CHAR_BIT}的值为8,{SCHAR_MAX}的值为127,{SCHAR_MIN}的值为-128,而{UCHAR_MAX}的值为255.

{CHAR_BIT} has the value 8, {SCHAR_MAX} has the value 127, {SCHAR_MIN} has the value -128, and {UCHAR_MAX} has the value 255.

换句话说,链接的IEEE页面不适用于字节长度不为8 的体系结构.这与POSIX一致,后者需要8位字符.

In other words, the linked IEEE page does not apply to architectures with other byte lengths than 8. This is in line with POSIX which requires 8 bit char.

-编辑之前-

解释在您链接到的页面上的注释中;

The explanation is in a note on the page you linked to;

这篇关于stdint的int8_t可以存在于没有8位字节的体系结构上吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 18:01
查看更多