c++ - 填充基本类型的可能性

标签 c++ integer language-lawyer padding data-representation

cppreference 所述(强调我的):

The value of std::numeric_limits::digits is the number of digits in base-radix that can be represented by the type T without change. For integer types, this is the number of bits not counting the sign bit and the padding bits (if any). For floating-point types, this is the number of digits in the mantissa.

实现可以向基本类型添加填充位。是否有任何实际填充这些类型的实现?这个措辞是支持所有硬件所必需的,还是这只是偏执狂的标准?

最佳答案

std::numeric_limits<bool>::digits返回 1,表示 bool被填充(通常是 8 位中的 7 位)。

关于c++ - 填充基本类型的可能性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56813685/

相关文章:

C++ VB6接口(interface)问题

c++ - 使用 auto 初始化 QFile

c - 如何将 while 中的 if-else 语句放入 for 循环中?

c++ - 注入(inject)的类名可以用作友元声明中的类型名吗?

c++ - C++中位运算符的定义是什么?

c++ - 在 Visual Studio 2010 中使用 fuzzylite

c++ - 静态 Objective-C 类中的内存

java - 除了 ConcurrentModificationException 之外,这段代码还能抛出任何其他异常吗?

javascript - 如何使用 javascript 将 -1 转换为 1?

c++ - Clang 或 GCC 拒绝/接受此 CTAD 代码是否正确?