在 2022-06-03 09:34, sisyphus 写道:
It does, however, issue a compile-time warning in relation to the second (inet_ntop) of the two declarations:try.c(7): warning C4028: formal parameter 4 different from declaration
The Microsoft variation has its 4th parameter as a `size_t`, while your prototype, aligned with POSIX, has it as a `socklen_t` i.e. `int`.
```The same problem arises with mingw runtime 9, but earlier runtimes are fine because InetNtopA does not get defined.If I comment out the 2 prototypes, then there's (pretty obviously) no issue with either gcc or msvc. Is this just a difference in what gcc and MSVC regard as fatal errors ?
Perhaps MSVC is more tolerant to such errors. A function that is declared neither `static` nor `extern` is implicitly extern, and it is not sensible to declare it both static and extern.
AFAICT, this Perl patch I'm trying to get right does not need to be applied when the compiler is Visual Studio 2019.However, applying it to Visual Studio 2019 builds doesn't seem to break anything.
I still consider it a bad idea to declare functions with the same names as standard ones. Why not rename it to `my_inet_ntop` for example? it would be much less error-prone.
-- Best regards, LIU Hao
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
