[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] dirname.h self-contained?

From: James Youngman
Subject: Re: [Bug-gnulib] dirname.h self-contained?
Date: 26 May 2003 23:31:30 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Oskar Liljeblad <address@hidden> writes:

> Also, browsing the other gnulib modules I encountered this:
> Most of the time stddef.h is included unconditionally, but
> sometimes it is included like this (regex.h):
>   #if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
>   /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
>      should be there.  */
>   # include <stddef.h>
>   #endif

There must be a reason why the inclusion of stddef.h isn't done
whenever we determine that it's available, but I don't know what it

> sometimes like this (fnmatch.c):
>   #if defined STDC_HEADERS || defined _LIBC
>   # include <stddef.h>
>   # include <stdlib.h>
>   #endif

This will certainly work; AC_HEADER_STDC causes STDC_HEADERS to be
#defined if stdlib.h, stdarg.h, string.h and float.h are all

I suppose there might be systems where stddef.h and stdlib.h are
available but don't define size_t, but I' dnot say it's worth worrying
about the possibility overmuch.

> or like this (localcharset.c):
>   # include <stddef.h>
>   #endif

This is plainly correct.  

> or (printf-args.h):
>   #ifdef HAVE_WCHAR_T
>   # include <stddef.h>
>   #endif

This does, on the face of it, seem a bit odd.  However, there is
method to it.  What's happening is that the gt_TYPE_WCHAR_T macro in
m4/wchar_t.m4 #includes <stddef.h> in a test program, and determines
if wchar_t is thus available.   Hence if this test works, we know that
not only is wchar_t is available, but it lives in <stddef.h>.  So that
code snippet looks a bit odd, but it's correct. 

James Youngman
Manchester, UK.  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]