如 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/