[Fwd: size_t is defined as an `int'.]
Wed Oct 18 17:31:00 GMT 2000
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.
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)
More information about the Newlib