[Mingw-users] socklen_t data type

Back to archive index
Eli Zaretskii eliz****@gnu*****
Tue Jun 30 02:09:42 JST 2020


MinGW 5.3.x changed the data type of socklen_t to 'unsigned int' in
ws2tcpip.h (it was 'int' in previous versions).  This causes trouble
when compiling a recent GDB: both Gnulib and GDB's own sources assume
that socklen_t is a signed int.  Moreover, winsock functions like
'accept' and 'getsockname', expect an 'int *' type of their last
argument, and it is customary to pass a 'socklen_t *' value there.

MinGW64 also uses a signed int.

We could of course tell Gnulib, GDB, and the rest of folks to get
their act together and not make such assumptions, but instead add
configure-time tests for the definition of the type and its
signedness.  But is there a good reason for MinGW to make socklen_t an
unsigned data type?  It looks like it's more trouble than help -- if
we want to keep this, we'd need to fight half the world and their dog
to not make the assumptions they do now.

TIA



More information about the MinGW-Users mailing list
Back to archive index