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]

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



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.

-- 
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


Hi,

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 :

 http://www.lysator.liu.se/c/index.html

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

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

Should size_t be changed ?

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



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