bug-gnulib
[Top][All Lists]
Advanced

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

Re: socklen_t


From: Bruno Haible
Subject: Re: socklen_t
Date: Thu, 1 Sep 2005 12:51:25 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:
> POSIX says both sys/socket.h and netdb.h should declare
> socklen_t, I was thinking of the case where a system doesn't have
> sys/socket.h but has netdb.h.

Yes, this is the case that can cause trouble. Some very old systems fall in
this category.

> Do you think we should only test for it in sys/types.h + sys/socket.h?

Yes.

> There is a problem, of course, if it _is_ defined in netdb.h and the
> application include that header file, but the test does not look
> there.  Then there will be a type conflict.

We need to somehow avoid the type conflict in that case. The goal should
be that
  #include "config.h"
  #include <sys/types.h>
  #include <sys/socket.h>
defines socklen_t.

Like we do with EILSEQ: There are some systems which define it in <wchar.h>
but not in <errno.h>. So we needed to somehow transport the definition from
<wchar.h> to config.h, so that
  #include "config.h"
  #include <errno.h>
is sufficient to define EILSEQ.

> Perhaps the M4 macro should create a socklen.h that include the proper
> header files that is required to get the socklen_t type?  That would
> be the most flexible, I think.

It is the most flexible, yes. But unless needed, I would prefer the
solution that is simpler for the application programs.

Bruno





reply via email to

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