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

Joel Sherrill joel.sherrill@OARcorp.com
Wed Oct 18 11:29:00 GMT 2000

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.


Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

To : rtems <rtems-users at oarcorp dot com>
Subject : size_t is defined as an `int'.
>From : Chris Johns <cjohns at cybertec dot com dot au>
Date : Fri, 01 Sep 2000 23:35:53 +1100
Organization : Cybertec Pty Ltd


Someone on a project I am working on spotted `size_t' is an `int'. The
ANSI standard states it should be an `unsigned int'. I found the
definition in a RTEMS newlib file.

  newlib-1.8.2/newlib/libc/sys/rtems/sys/types.h :
   typedef int size_t;            /* see C Standard XXX */ 

I found "N843, the Final Committee Draft" of the ANSI C standard at :


To quote the section "Common definitions <stddef.h>" :

 "  size_t
   which is the unsigned integer type of the result of the sizeof

Should size_t be changed ?

 Chris Johns, mailto:cjohns@cybertec.com.au mailto:ccj@acm.org

More information about the Newlib mailing list