bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Jim Meyering
Subject: Re: [Bug-gnulib] dirname.h self-contained?
Date: Tue, 27 May 2003 08:58:51 +0200

Oskar Liljeblad <address@hidden> wrote:
> I don't know if the idea is to make each header file provided by
> gnulib self-contained or not,

Usually it is.
If not, there should be a good reason and
a comment describing the dependency.

> but if it is then dirname.h needs
> some #include for size_t. I guess the needed header file is
> <stddef.h>.
>
> This patch is related to this problem:
>
>   http://mail.gnu.org/archive/html/bug-gnulib/2002-12/msg00044.html
>
> 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
>
> sometimes like this (fnmatch.c):
>
>   #if defined STDC_HEADERS || defined _LIBC
>   # include <stddef.h>
>   # include <stdlib.h>
>   #endif
>
> or like this (localcharset.c):
>
>   #if HAVE_STDDEF_H
>   # include <stddef.h>
>   #endif

IMHO, the way to do it is like this:

  #include <stddef.h>
  #include <stdlib.h>

The others may be changed eventually.
These days, the few systems without those header files
are so few that it's not worth supporting them.
fnmatch and regex lag a bit because they are kept in
sync with libc, and it takes more work for us to update those.




reply via email to

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