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

Nelson H. F. Beebe beebe at math.utah.edu
Mon Oct 16 10:23:55 PDT 2006

In a posting of 18-Jul-2003,


a user reported a problem with LSB that can still be exhibited today
with this two-line test file:

	% cat bug-lsbcc.c
	#include <sys/types.h>
	size_t p;

	% /opt/lsb/bin/lsbcc bug-lsbcc.c
	bug-lsbcc.c:2: error: syntax error before "p"
	bug-lsbcc.c:2: warning: data definition has no type or storage class

	% /opt/lsb/bin/lsbcc --version
	cc (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)

The error is that POSIX requires that <sys/types.h> define size_t, but
LSB fails to do so, and more than three years after the sourceforge
bug report above, still has not fixed this error.

I have been using lsbcc in routine software builds in my large test
lab only since late June 2006, and I first found the error when I did
builds of the latest GNU m4 release that appeared on 25-Sep-2006.

It is the view of the GNU m4 developers that lsbcc is in error here,
and as a result, they do not wish to modify m4 source code to make the
error disappear under lsbcc compilation.

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:

12927 NAME
12928           sys/types.h -- data types
12930           #include <sys/types.h>
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>.

Are there plans to fix this deficiency in the LSB implementation of

- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -

More information about the lsb-discuss mailing list