[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strnlen.h
From: |
Simon Josefsson |
Subject: |
Re: strnlen.h |
Date: |
Fri, 08 Sep 2006 11:37:07 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
Paul Eggert <address@hidden> writes:
> "Mark D. Baushke" <address@hidden> writes:
>
>> If you must check for it being defined, wouldn't this form
>>
>> #if !defined HAVE_DECL_STRNLEN || !HAVE_DECL_STRNLEN
>
> In the old days we were worried about people using gnulib .c files
> without using the corresponding .m4 code. In such a case,
> HAVE_DECL_STRNLEN wouldn't be defined, but the code still shouldn't
> declare strnlen.
>
> These days the gnulib packaging process pretty much makes these
> concerns obsolete. So it's OK to use "#if !HAVE_DECL_STRNLEN"
> nowadays, I think.
The autoconf manual still suggests to use the former. Perhaps that
wording can be relaxed further...
Unlike the other `AC_CHECK_*S' macros, when a SYMBOL is not
declared, `HAVE_DECL_SYMBOL' is defined to `0' instead of leaving
`HAVE_DECL_SYMBOL' undeclared. When you are _sure_ that the check
was performed, use `HAVE_DECL_SYMBOL' just like any other result
of Autoconf:
#if !HAVE_DECL_SYMBOL
extern char *symbol;
#endif
If the test may have not been performed, however, because it is
safer _not_ to declare a symbol than to use a declaration that
conflicts with the system's one, you should use:
#if defined HAVE_DECL_MALLOC && !HAVE_DECL_MALLOC
void *malloc (size_t *s);
#endif
You fall into the second category only in extreme situations:
either your files may be used without being configured, or they
are used during the configuration. In most cases the traditional
approach is enough.
- strnlen.h, Mark D. Baushke, 2006/09/07
- Re: strnlen.h, Paul Eggert, 2006/09/07
- Re: strnlen.h,
Simon Josefsson <=