Menu

#764 inet_ntop signature outdated (lacking const)

v1.0 (example)
open
nobody
None
5
2018-10-24
2018-10-24
Marcel Raad
No

inet_ntop / InetNtopW / InetNtopA currently takes its pAddr argument as a PVOID:
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/4c2df0d02ed71ae07e85f1b35ac857a148cd2b8f/tree/mingw-w64-headers/include/ws2tcpip.h#l446

This was the old definition and changed to const PVOID in the Windows 10 SDK:
https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-inetntopw

The const version is also what POSIX wants. Having it as non-const leads to "discarded-qualifiers" GCC warnings in portable code. This happens for example in curl:
https://github.com/curl/curl/blob/3349a633b8b181bfd1825b36d8cca51f5a20defd/lib/hostip.c#L185

Discussion


Log in to post a comment.

MongoDB Logo MongoDB