[PATCH 64bit] ssize_t

Ralf Corsepius ralf.corsepius@rtems.org
Wed Feb 20 18:19:00 GMT 2013


On 02/20/2013 06:16 PM, Ralf Corsepius wrote:

> GCC doesn't apply a size-based logic to define size_t, but applies
> hard-coded predefined types for size_t, likely based on historic
> per-target conventions.
>
> I.e. any type-size based logic will sometimes fail:
>
> E.g. for targets with sizeof(size_t) == sizeof(int) == sizeof(long). on
> some targets GCC uses "typedef unsigned int size_t" and on other targets
> GCC uses "typedef unsigned long size_t".


Real world cases:

sparc-rtems*/sparc-*elf:
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG__ 4
#define __SIZEOF_SIZE_T__ 4
#define __SIZE_TYPE__ unsigned int


i386-rtems*/i386-*elf:
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG__ 4
#define __SIZEOF_SIZE_T__ 4
#define __SIZE_TYPE__ long unsigned int

Ralf



More information about the Newlib mailing list