Re: 24 bits (u)ints

Georg-Johann Lay <[email protected]> Wed, 30 Nov 2016 17:07:49 +0100
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
On 30.11.2016 15:32, Paul "LeoNerd" Evans wrote:
> On Wed, 30 Nov 2016 18:18:11 +0530
> Senthil Kumar Selvaraj <[email protected]> wrote:
>
>> Diogo Martins Silva writes:
>>
>>> Hello all.
>>>
>>> The avr-gcc wiki (https://gcc.gnu.org/wiki/avr-gcc) lists 24 bits
>>> (u)ints as an extension since version 4.7. How do I use them?
>>
>> Use __uint24 as the type. Like so
>>
>> $ cat test.c
>> volatile __uint24 x;
>> int main() {
>>   x++;
>>   x--;
>> }
>
> Is it possible to get that added to <stdint.h> as the expected names
>
>   int24_t
>   uint24_t
>
> ?

The C99 and later standards don't supply these types or reserve these 
identifiers.  Since C99, "int8_t" is an identifier that resides in the 
namespace of the implementation, whereas "int24_t" is still in the 
namespace of the application.  Hence, for the new 3-byte types names 
were chosen that are in the namespace of the implementation, i.e. 
reserved identifiers which start with "__" (__int24 and __uint24).

If you like you can define such types in your application, but they 
should not go into any standard header.

Johann