Boost logo

Boost :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-06-09 11:56:57


----- Original Message -----
From: "Rob Stewart" <stewart_at_[hidden]>
> From: Martin Bonner <martin.bonner_at_[hidden]>

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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk