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

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

Re: [avr-gcc-list] 24 bits (u)ints


From: Georg-Johann Lay
Subject: Re: [avr-gcc-list] 24 bits (u)ints
Date: Wed, 30 Nov 2016 17:07:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 30.11.2016 15:32, Paul "LeoNerd" Evans wrote:
On Wed, 30 Nov 2016 18:18:11 +0530
Senthil Kumar Selvaraj <address@hidden> 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





reply via email to

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