Data type problem

Stéphane ARQUER stephane.arquer at c-s.fr
Tue Oct 16 09:18:30 CDT 2007


I succeeded to compile with
#include <sys/types.h>

Thanks for your help.

sa


Le 15/10/2007, "Ralf Corsepius" <ralf.corsepius at rtems.org> a écrit:

>On Mon, 2007-10-15 at 15:15 +0200, Juergen Zeller wrote:
>> try things like this:
>>
>> typedef signed char        int8;
>> typedef unsigned char      uint8;
>> typedef signed short       int16;
>> typedef unsigned short     uint16;
>> typedef signed int         int32;
>> typedef unsigned int       uint32;
>> typedef signed long long   int64;
>> typedef unsigned long long uint64;
>
>Don't!
>
>These are (POSIX, ANSII, ISO, C99) standardized types you are not
>supposed to define/typedef.
>
>As Joel already wrote: #include <stdint.h>
>
>> typedef unsigned char      byte;
>> typedef unsigned short int word;
>> typedef unsigned int       dword;
>
>If you really need fixed size types, use uint8_t, uint16_t etc.
>
>If you need a "byte" (in the sense of "minimal addressable machine
>unit") use "signed char" or "unsigned char".
>
>If you need 8-bit types, use uint8_t rsp. int8_t.
>
>
>
>Though on most modern architectures the assumptions of "char == byte ==
>8bit" etc. apply, there is no guarantee that they really are.
>Esp. on embedded targets these occasionally do NOT apply.
>
>E.g. in RTEMS, we have several architectures for which "int == 16bit"
>applies, and we have one architecture for which
>"char == short == int == 32bit" applies.
>
>Ralf
>

-------------------------------------------------
Stéphane ARQUER
CSSI - Division Aéronautique, Logiciels Embarqués
email: stephane.arquer at c-s.fr
-------------------------------------------------




More information about the rtems-users mailing list