[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] dirname.h self-contained?
From: |
Bruno Haible |
Subject: |
Re: [Bug-gnulib] dirname.h self-contained? |
Date: |
Tue, 27 May 2003 13:56:26 +0200 (CEST) |
Oskar Liljeblad writes:
> I don't know if the idea is to make each header file provided by
> gnulib self-contained or not
Yes it is desired that each .h file can be included without any
prerequisites and without ordering constraints. Now even glibc's
<regex.h> has become self-contained (since 2003-04-17).
> but if it is then dirname.h needs some #include for size_t. I guess
> the needed header file is <stddef.h>.
Right, for size_t you need <stddef.h> or <stdlib.h>. So if one needs
nothing from <stdlib.h> I prefer <stddef.h> since it is smaller.
> Also, browsing the other gnulib modules I encountered this:
> Most of the time stddef.h is included unconditionally
We are generally assuming ANSI C89 by now. See also
http://mail.gnu.org/archive/html/bug-gnulib/2002-11/msg00031.html
> but sometimes it is included like this (regex.h):
That's because regex.h is shared with glibc, and noone has so far
bothered to convince the glibc maintainers that removing K&R C
compatibility has a value in this case.
> #if defined STDC_HEADERS || defined _LIBC
> # include <stddef.h>
> # include <stdlib.h>
> #endif
I wouldn't write code like that. There is no reason to not #include
<stddef.h> and/or <stdlib.h> on IRIX 4 just because this system has a
non-standard <ctype.h>.
Jim Meyering wrote:
> IMHO, the way to do it is like this:
>
> #include <stddef.h>
> #include <stdlib.h>
And if all you need is size_t, then just <stddef.h> is enough.
Bruno
- [Bug-gnulib] dirname.h self-contained?, Oskar Liljeblad, 2003/05/26
- Re: [Bug-gnulib] dirname.h self-contained?, James Youngman, 2003/05/26
- Re: [Bug-gnulib] dirname.h self-contained?, Jim Meyering, 2003/05/27
- Re: [Bug-gnulib] dirname.h self-contained?,
Bruno Haible <=
- Re: [Bug-gnulib] dirname.h self-contained?, Paul Eggert, 2003/05/27
- Re: [Bug-gnulib] dirname.h self-contained?, Bruno Haible, 2003/05/27
- Re: [Bug-gnulib] dirname.h self-contained?, Jeff Bailey, 2003/05/27
- Re: [Bug-gnulib] dirname.h self-contained?, Paul Eggert, 2003/05/29
- Re: [Bug-gnulib] dirname.h self-contained?, Paul Eggert, 2003/05/29
- Re: [Bug-gnulib] dirname.h self-contained?, Jim Meyering, 2003/05/30
- Re: [Bug-gnulib] dirname.h self-contained?, Bruno Haible, 2003/05/30