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'.]
- To: joel dot sherrill at OARcorp dot com
- Subject: Re: [Fwd: size_t is defined as an `int'.]
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Wed, 18 Oct 2000 20:30:56 -0400
- CC: newlib at sources dot redhat dot com
- Organization: Red Hat Inc.
- References: <39EDE9BE.7CBE7E3F@OARcorp.com>
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;
Everywhere I looked in glibc, it punts the underlying definition of size_t to stddef.h
after defining __need_size_t.
Do you have an example of glibc defining size_t to signed? By any chance is your compile
setting one of the special defines used in stddef.h to override size_t (e.g. __SIZE_TYPE__)?
-- Jeff Johnston (Red Hat Inc)