This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Fwd: size_t is defined as an `int'.]


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]