The Open Source Swiss Army Knife

/code/c/unix_c/
/code/c/unix_c/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /code   /c   /unix_c 
Permalink: size_t.txt
Title: how big is size_t and ssize_t difference size_t and ssize_t
article options : please login   |  raw source view  

size_t and ssize_t


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.

......

refernceing: http://sources.redhat.com/ml/newlib/2000/msg00338.html

ssize_t example: readblock.c (at present it's under filedes/)

I ran gcc -E on that and got:

(on redhat)

typedef unsigned int size_t;
typedef int __ssize_t;

(onsolaris)

typedef unsigned int size_t;
typedef int ssize_t;

yes!! a difference!!


Leave a Reply
Your Name:     anonymous
Your Email:
Website:  
Comments:

The author will be notified of your reply.
return to top