avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] 24 bit Integer


From: Dave Hansen
Subject: RE: [avr-gcc-list] 24 bit Integer
Date: Wed, 30 Jul 2008 11:36:24 -0400



From: address@hidden

> 2008/7/14 Weddington, Eric <address@hidden>:
> > A 24-bit integer is not supported by the C language. In theory, support
> > could be added to GCC, but then it would be considered an extension to
> > the C language. And it would also be difficult and/or time-consuming to
> > add to GCC.
>
> The C standard doesn't dictate the size of any integer type, except that char
> must be large enough to hold the environments standard character set and
> the size of any larger types is ordered as you'd expect.
> char <= short <= int <= long
 
Also that short and int must be able to represent at least -32767 to +32767, and long must be able to represent +/-2,147,483,647.  So int24_t would have to be a special type outside the standard types.
 
And I think (though I'm not certain) that it would have to be promoted to long before any operator could be applied.  Some of that would be mitigated by the as-if rule, of course...

> int is typically the natural word size for the architecture, but often on 8 bit
> micros it will be larger (since char typically provides an 8 bit int anyway.)

It's larger because an 8 bits can't represent the required range of values.
 
Regards,
 
   -=Dave
 


Time for vacation? WIN what you need. Enter Now!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]