<resolv.h> requires <netinet/in.h>
Yaakov (Cygwin/X)
yselkowitz@users.sourceforge.net
Mon Dec 8 23:54:00 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Pierre A. Humblet wrote:
> Every version of man resolver that I have ever seen specifies:
>
> SYNOPSIS
> #include <sys/types.h>
> #include <netinet/in.h>
> #include <arpa/nameser.h>
> #include <resolv.h>
>
> So it's up to the user to include the right files.
Perhaps so, but:
1) <resolv.h> already #includes all of those headers *except* for
<netinet/in.h>.
2) this does not match Linux behaviour:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/resolv/resolv.h?cvsroot=glibc
As I stated, my STC was based on a configure test which works on other
platforms; I don't see why we shouldn't match that.
> Sure we can make an exception for Cygwin, but the same program can then fail elsewhere.
I agree that for portability, a program should not assume that #include
<resolv.h> automatically #include <netinet/in.h> and use the latter's
functions or typedefs. But the bottom line here is that <resolv.h>
requires struct sockaddr_in, so it needs that #include.
Yaakov
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEAREIAAYFAkk9s0YACgkQpiWmPGlmQSMO/ACg1fIAqsvbkNC3CF3XnM/hQmBD
emwAn3jFN6zrj55wieyYvNawpI/HOkD4
=uV4z
-----END PGP SIGNATURE-----
More information about the Cygwin-patches
mailing list