[Top][All Lists]

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

socklen_t data type

From: Eli Zaretskii
Subject: socklen_t data type
Date: Mon, 29 Jun 2020 20:23:30 +0300

Gnulib's sys/socket.h has this:

  # if @HAVE_WINSOCK2_H@
  /* Include headers needed by the emulation code.  */
  #  include <sys/types.h>
  #  include <io.h>

  #  if !GNULIB_defined_socklen_t
  typedef int socklen_t;
  #   define GNULIB_defined_socklen_t 1
  #  endif

  # endif

This unconditionally defines socklen_t on MS-Windows systems as a
signed int data type.  Why is this unconditional?  This page:



  <sys/socket.h> makes available a type, socklen_t, which is an
  unsigned opaque integral type of length of at least 32 bits.

So socklen_t could be an unsigned data type, which would then conflict
with the above.

And in fact mingw.org's MinGW recently changed the socklen_t data type
to be unsigned int, which breaks compilation of Gnulib's
sys_socket.c.  Is MinGW in error here?

reply via email to

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