[RFC 00/17] Merge event loop implementations

Eli Zaretskii eliz@gnu.org
Fri Sep 27 14:21:00 GMT 2019


> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 27 Sep 2019 15:05:27 +0100
> 
> But, given that gdb (unlike gdbserver), has been using "int"
> for sockets on Windows for a long while, and 64-bit Windows
> has been a thing for a long while too, I wonder whether in
> practice Windows just makes sure that SOCKET handles
> fit in 32-bit integers, exactly to avoid porting headaches...

SOCKET is a 64-bit data type on 64-bit Windows.  However, according to
this:

  https://stackoverflow.com/questions/1953639/is-it-safe-to-cast-socket-to-int-under-win64

Microsoft is unlikely to ever populate the high 32 bits with anything
but zero.

So I'd generally recommend using DWORDPTR or uintptr_t for SOCKETs,
but I'm guessing we are good using unsigned ints instead, if changing
that is too much trouble.



More information about the Gdb-patches mailing list