gpt4 book ai didi

c++ - 作为抽象,C++ 是否支持 "bits"表示两个以上值之一?

转载 作者:IT老高 更新时间:2023-10-28 23:19:29 24 4
gpt4 key购买 nike

[C++11: 1.7] 用比特来谈bytes:

The fundamental storage unit in the C++ memory model is the byte. 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. The least significant bit is called the low-order bit; the most significant bit is called the high-order bit. The memory available to a C++ program consists of one or more sequences of contiguous bytes. Every byte has a unique address.

但是,我在定义“位”的标准中找不到任何地方。

那么说 C++ 对单个位可以表示的值的数量没有限制是真的吗?

它是否允许三态位?

最佳答案

[C++11: 1.2] 中列出的规范性引用中有“ISO/IEC 9899:1999,编程语言 — C”。

反过来,这个标准说:

[C99: 3.5]: 1 bit unit of data storage in the execution environment large enough to hold an object that may have one of two values

这并不排除比特是一个更大的数据存储单元,因此 C++ 作为一门语言确实可以支持三态比特。

关于c++ - 作为抽象,C++ 是否支持 "bits"表示两个以上值之一?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12655875/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com