autoconf
[Top][All Lists]
Advanced

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

Re: Which header a symbol is declared in (AC_CHECK_DECLS) ?


From: Eric Blake
Subject: Re: Which header a symbol is declared in (AC_CHECK_DECLS) ?
Date: Mon, 27 Apr 2009 06:09:09 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Konstantin Andreev on 4/27/2009 3:20 AM:
> Hello.
> 
> 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.

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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkn1oGUACgkQ84KuGfSFAYDaNQCdGq1z6K33pnCdAhYT1VjiPJgN
CmMAoKOE4ug6lkuXOZYNXv37jdFsb9BO
=cQa6
-----END PGP SIGNATURE-----




reply via email to

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