为什么一个字节(以位为单位)的大小是实现定义的并带有该变量?我认为一个字节总是与 8 位一致

Why is the size of one byte (in bits) implementation-defined and with that variable? I´ve thought a byte is always consistent of 8 bits

在 C 标准中 f.e。 (我的参考文献特别是 ISO/IEC 9899:2011 (C11))在 §3.6 下说明:

3.6

1 byte

addressable unit of data storage large enough to hold any member of the basic character set of the execution environment

2 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.

3 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementationdefined. The least significant bit is called the low-order bit; the most significant bit is called the high-order bit.

为什么会这样?我认为一个字节的大小在信息技术中是绝对固定的,正好由 8 位组成。

为什么标准会做出这个看似疯狂的声明?

还有: 如果字节大小不固定,我们怎么能谈论f.e。 char 由 8 位组成,int 由 32 位(4 字节)组成,假设是 64 位系统?

I thought the size of a byte is absolute fixed in the technology of information to be comprised of exactly 8 bits.

没有。那就是 "byte" 的演变,现在很常见 8.

其他值 9、16、18、32、64 .... 因各种技术(和业务)原因而出现。他们今天的稀有性确实令人惊讶 CHAR_BIT 可能不是 8.

Recall C 非常便携并且适用于范围广泛的体系结构。


If the byte size isn´t fixed, how we can talk about f.e. a char to be comprised of 8 bits and an int of 32 bits (4 Bytes), assuming 64-bit systems?

在 C 中,您通常不能。 char 可能是 9 位或 64 位,等等。现在这样的系统很少见。

避免将 "assuming 64-bit systems" 作为将 int 大小驱动到某个宽度的要求。更多因素适用。