Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: unsigned long versus unsigned int on ARM7

2005-11-10 by Richard

At 08:51 AM 11/10/2005, rtstofer wrote:


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

Richard, I don't recall whether they use the same language for C86/C89/etc. 
or not, but my reading of your excerpt is that your interpretation is 
incorrect. Looks to me that under C99, it is still

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long 
long)

> >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
>
>
>
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>

// richard (This email is for mailing lists. To reach me directly, please 
use richard at imagecraft.com)

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.