This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [Fwd: size_t is defined as an `int'.]
Joel Sherrill wrote:
>
> "J. Johnston" wrote:
> >
> > Joel Sherrill wrote:
> > >
> > > This came across the RTEMS list. I would like some opinions
> > > since it appears that the glibc on RedHat 6.2 also uses
> > > "int". Solaris 2.x appears to use unsigned int.
> > >
> > > Comments.
> > >
> >
> > size_t must be unsigned as defined in the ANSI, POSIX, and Single UNIX standards. A signed version
> > ssize_t is defined in POSIX and Single UNIX.
> >
> > The underlying definition of size_t is in stddef.h which is part of the compiler.
> > A small test case on my Linux 6.2 using gcc version 2.95.2 gives the following in
> > the -E output:
> >
> > typedef unsigned int size_t;
>
> When I tried this I get the same results on the native compiler and
> one of the cross rtems (powerpc). I guess this report and (I know) my
> analysis were based on grep'ing the include files. There is an
> incorrect definition of size_t in newlib/libc/sys/rtems/sys/types.h.
> Based on this discussion, should that file simply include stddef.h and
> eliminate some code?
>
That is what newlib's sys/types.h does.