[lsb-discuss] LSB, <sys/types.h>, POSIX, and size_t typedef

Wichmann, Mats D mats.d.wichmann at intel.com
Mon Oct 16 10:49:28 PDT 2006


Okay, I looked one level deeper.

>The relevant text from the POSIX standard (IEEE Std 1003.1-2001
>(Revision of IEEE Std 1003.1-1996 and IEEE Std 1003.2-1992) is on
>pages 365--366 of the first of the four volumes:
>
>12932           The <sys/types.h> header shall include 
>definitions for at least the following types:
>...
>12963               size_t                           Used for 
>sizes of objects.
>12964               ssize_t                          Used for 
>a count of bytes or an error indication.
>
>It should be noted that <sys/types.h> is not part of ISO Standard C,
>so the ISO 1999 C and 1998 and 2003 C++ standards say nothing about
>that header file.  Instead, they require size_t to be defined in
><stddef.h>, and well as in <stdio.h>, <stdlib.h>, <string.h>,
><time.h>, and <wchar.h>.

To be more precise, POSIX /also/ requires size_t to actually be
defined in <stddef.h>:

11205  The <stddef.h> header shall define the following types
...
11212  size_t    Unsigned integer type of the result of the sizeof
operator.

The difference between these two wordings is that the <sys/types.h>
wording leaves room for definition by inclusion of another file;
LSB matches the requirement for stddef.h by defining it there.
The problem unique to the LSB header files is that inclusions
are generated by reference only, there is no current way to
say "<sys/types.h> needs to include <stddef.h>" other than for
the former to actually reference something defined in the latter.
This is not the case at the moment.

So somehow we need to solve the implementation problem in order
to make this go away.




More information about the lsb-discuss mailing list