[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: Which header a symbol is declared in (AC_CHECK_DECLS) ?
From: |
Konstantin Andreev |
Subject: |
Re[2]: Which header a symbol is declared in (AC_CHECK_DECLS) ? |
Date: |
Mon, 27 Apr 2009 19:52:35 +0400 |
Hello, Eric.
On Fr, 27/04/2009 06:09 -0600, you wrote:
> According to Konstantin Andreev on 4/27/2009 3:20 AM:
> >
> > Could you advise, how to correctly determine which header a symbol is
> > declared in ?
>
> Why? Functionally, all you need to know is whether a symbol is declared
> within a set of headers, rather than trying to go the extra mile to figure
> out which exact header. So for this particular case, I would have used
> something like:
>
> AC_CHECK_DECLS([bzero],[],[],[AC_INCLUDES_DEFAULT
> [#include <string.h>
> #ifdef HAVE_STRINGS_H
> # include <strings.h>
> #endif
> ]])
>
> to find whether bzero is declared in either string.h or strings.h, then
> include both headers in my code.
>
I have heard that 'string.h' and 'strings.h' are incompatible on some
systems, and including both may causes problems. So, if I include only
one of them, I increase portability.
> But ultimately, bzero is declared obsolete by POSIX. If you REALLY want to
> be portable, I'd write your code to use memset and not bzero.
>
You are certainly right concerning 'bzero', but the question remains out
of purely academic interest:
What is the simplest way to determine with autoconf the exact header,
where the symbol is declared in ?
Best regards,
--
Konstantin Andreev.