size_t is defined as an `int'.

Chris Johns cjohns at cybertec.com.au
Fri Sep 1 12:35:53 UTC 2000


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 at cybertec.com.au mailto:ccj at acm.org



More information about the users mailing list