填充基本类型的可能性
Possibility of padding in fundamental types
如 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
returns 1,表示bool
被填充(通常是8位中的7位)。
如 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
returns 1,表示bool
被填充(通常是8位中的7位)。