Is "long" Guaranteed to be at Least 32 Bits?
While the C Standard dictates a hierarchical progression in the sizes of fundamental integral types (with "long int" being the largest), it does not explicitly mandate a specific bit width for "long." However, there is a crucial determinant that ensures "long" is at least 32 bits.
The C Standard inherits C's limits (18.3.2) for "LONG_MIN" and "LONG_MAX," which are defined as -(2^31 - 1) and (2^31 - 1), respectively. This implies that "long" must be capable of storing values in this range.
Additionally, "std::numeric_limits
In conclusion, while "long" may have a variable bit representation in different implementations, it is guaranteed to be at least 32 bits due to the requirements for its minimum and maximum values. This is determined by the C limits inherited by C and the way "std::numeric_limits" handles those limits.
The above is the detailed content of Is \'long\' Guaranteed to Be at Least 32 Bits in C ?. For more information, please follow other related articles on the PHP Chinese website!