
----- Original Message ----- From: "Rob Stewart" <stewart@sig.com>
From: Martin Bonner <martin.bonner@pitechnology.com>
What you have missed Rob is that the standard requires SHRT_MIN <= -32767 and SHRT_MAX >= 32767. That implies short must have at least 16 bits.
There is a similar requirement on long that means it must be at least 32 bits.
Thanks for jumping in, but where is that in the standard? I have ISO/IEC 14882, 1st ed. What should I have?
The C standard unfortunately. 18.2.1.1 footnote 182 & 183 says that the numeric_limits<short>::max is equal to SHRT_MAX and numeric_limits<short>::min is equal to SHRT_MIN. The C standard says the SHRT_MIN and SHRT_MAX should have an absolute values >= 32767. The std::numeric_limits<short>::max also has to return a value of type short, taken together this combination of rules implies that short has to be at least 16 bits. HTH Christopher Diggins http://www.cdiggins.com