> That is wrong. The C standard requires that the following equality and > inequalities hold: > > 1 = sizeof(char) > > sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= > sizeof(long long) > As I understood the debate, the C99 spec has changed the inequality to strictly < not <= so there had to be a difference in size between the various types. But this may not be correct... From the C99 standard section 6.3.1.1: 6.3.1.1 Boolean, characters, and integers 1 Every integer type has an integer conversion rank defined as follows: No two signed integer types shall have the same rank, even if they have the same representation. The rank of a signed integer type shall be greater than the rank of any signed integer type with less precision. The rank of long long int shall be greater than the rank of long int, which shall be greater than the rank of int, which shall be greater than the rank of short int, which shall be greater than the rank of signed char. The rank of any unsigned integer type shall equal the rank of the corresponding signed integer type, if any. But, I think the real answer is in section 7.18 where the standard deals with <stdint.h> and defines macros that represent specific widths. I think I need to read this a little more carefully. Then there is the matter of which standard applies; '99 or something earlier. Oh, and whether the compiler in question even claims standard compliance. Some don't... Richard
Message
Re: unsigned long versus unsigned int on ARM7
2005-11-10 by rtstofer
Attachments
- No local attachments were found for this message.