-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruce Korb on 3/20/2007 10:00 AM: >> The reason is that mkstemp is declared in <unistd.h>, not <stdlib.h>, on >> this platform. But for POSIX compatibility, only gnulib's <stdlib.h> should >> be sufficient to declare the function. I'm applying this: > > Just a question: is including "unistd.h" the right approach?
Yes, since the inclusion is only done when needed. And this is the approach taken in other situations of broken system headers, such as with the wchar module. > Not clear to me that pulling in all of unistd.h is the right way > since that means ``#include <stdlib.h>'' implies ``#include <unistd.h>''. MacOS is already broken for having to use <unistd.h> instead of <stdlib.h> to get mkstemp, so it doesn't break things any worse to have gnulib automatically pull in an extra header in this case. And since system headers are supposed to be idempotent, it shouldn't matter if the gnulib client does any of these three: #include <stdlib.h> /* use mkstemp */ #include <unistd.h> #include <stdlib.h> /* use mkstemp */ #include <stdlib.h> #include <unistd.h> /* use mkstemp */ You are correct that on MacOS, the namespace is a bit more polluted than necessary on a strict POSIX system, but in practice, that doesn't seem to be too much of a problem. Although the standard often allows you to use names for your own use if you avoid the headers where they are standardized, you are only asking for problems by doing that. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGAHzc84KuGfSFAYARAu6RAJ4iKl/L3XsgAZCx2iwuNYcpmz0WDQCgn8zY jQbZMDnr5/LADl5s5yoJp4M= =JT7N -----END PGP SIGNATURE-----