Ranges of unsigned types in C90

Ranges of unsigned types in C90

Post by Rob Artha » Wed, 01 Aug 2007 23:57:17


C90 6.1.2.5 says that the signed integer types are "signed char, short int,
int and long int" and that in that list "the range of values f each type is
a subrange of the values of the next type in the list". It does not make
the analogous statement for unsigned types and nothing I can see in the C90
standard seems to imply this. You are told that the non-negative values of
the signed types can be represented in the corresponding unsigned type
(with the same representation). C99 6.2.5p8 leaves no doubt about this for
C99.

So, am I missing something or could an implementation conform with C90 while
having SHRT_MAX = INT_MAX = UINT_MAX = 0x7ffffff but USHRT_MAX =
0xffffffff, for example? If this is allowed, are there any compilers out
there that actually do this kind of thing?

Regards,

Rob.
 
 
 

Ranges of unsigned types in C90

Post by Jun Woon » Fri, 10 Aug 2007 19:15:15


I don't think such a relationship among integer types was intended to
be allowed. The description for the ranges of the standard integer
types given in C90 failed to deliver what it was supposed to do.
DR171 would be helpful in understanding the intent:

http://www.yqcomputer.com/


``All opinions expressed are mine, and do not represent
the official opinions of any organization.''

 
 
 

Ranges of unsigned types in C90

Post by pete » Sat, 25 Aug 2007 09:43:29


I was looking at n1124, and wondering if there are
any plans to change the name of the part of the standard
that says nothing about the sizes of integer types, from:
5.2.4.2.1 Sizes of integer types <limits.h>
to something else?

--
pete