Re: socklen_t data type
Keith Marshall <[email protected]> Mon, 29 Jun 2020 22:34:58 +0100
| Newsgroups | gmane.comp.gnu.mingw.user |
|---|---|
| Organization | MinGW.org Project |
| Message-ID | <[email protected]> |
On 29/06/2020 18:09, Eli Zaretskii wrote: > MinGW 5.3.x changed the data type of socklen_t to 'unsigned int' in > ws2tcpip.h (it was 'int' in previous versions). The ChangeLog gives the reason as "signed is meaningless"; socklen_t represents the size of a data buffer, (nominally a struct sockaddr, but may also be used for other types of buffer associated with sockets), and conceptually, what would a buffer size of less than zero signify? > 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. Ouch! I'm guessing that the difference in "signedness" raises warnings, at best, and possibly even incompatible type conflict errors? > 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? Beyond the ludicrous concept of a negatively sized data buffer, and that unsigned is thus conceptually more logical, no. > 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. Okay. There is no question that socklen_t must be size-congruent with int, but signed int just seems conceptually illogical, for what is, in effect, an unsigned property. However, we live in an often illogical world, so if it makes life easier, feel free to modify your local copy, and I'll revert that change for future releases. -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F _______________________________________________ MinGW-Users mailing list [email protected] This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists. We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. _______________________________________________ You may change your MinGW Account Options or unsubscribe at: https://lists.osdn.me/mailman/listinfo/mingw-users Also: mailto:[email protected]?subject=unsubscribe
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAl76XoIACgkQwK02xjR+ Wj8bzRAAsamaFdcv3XRBAuUoFpvyS7kFqRhhjJgWZrHBqmlHDyPSCqefPNDjiHGs AuOhRIsUhqVKlE1ri2Z7A/lE8SzEzB++jCttSvS64Xld6HWQYlhUKkYhOEW7SFbp UnocW22XEf50D72dYWM2/vUFpEdA7KPQICMeenrZTuAKSFJHrTBxV+k4hEpOBycl tEJKIDJuVQLpCaWZXcVxcgY8uPuAqEkNR08k14uJjiZLErWrpgB9noNHonJPEQr7 91EGJD3ILi+uPAnFMYcWivckKba00EnxIXecSr1FzCmovWQWiyZZW8u/LQ0L3Y5W sLLKIubyQPrFmsY98fcHEMKy1aO89ibIGgbWjcaFK9evr/ajzgQXvv3EtMTHnlTE Yi6vKemsWaVxxo+wlLTMf8RTmztTXpNs9IQaFq91qVHGG4r54UeFKzA1XvYTGF70 4n5C75Lik0rSZsUBAJ8WAQujqmXBlJUce9YU+Jr8PxWs1dyGqzncRf37Xq074AbR Q4fAf3+Rs7f1SJPN9kqsyZba80PjWdj5K84O7kfjGYjyJVf+leeleM8SeHBDNRkS repxXVWJdWMHLdL1r9l0fekcbDaK2WUXp95LGzaDQ4UxCfrklEWrRxByZ9tZe4ii iaTr+G6Q0+svr+G4MAFb0gX/g6xmw4lc7oHZHVSKb8JNQtuSRyQ= =tIqD -----END PGP SIGNATURE-----