You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2019/11/12 00:00:52 UTC

[GitHub] [incubator-tvm] FrozenGene edited a comment on issue #4306: Fix incorrect call to Unicode Win32 InetPton

FrozenGene edited a comment on issue #4306: Fix incorrect call to Unicode Win32 InetPton
URL: https://github.com/apache/incubator-tvm/pull/4306#issuecomment-552671294
 
 
   @jmorrill I have  read the doc: https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-inetptonw. Seems that Windows has Unix's `inet_pton` function too. i.e. InetPtonA defines. Do you think we should be better to use `inet_pton` directly and needn't distinguish _WIN32 / Unix?
   
   i.e.
   ```
   inline bool ValidateIP(std::string ip) {
     if (ip == "localhost") {
       return true;
     }
     struct sockaddr_in sa_ipv4;
     struct sockaddr_in6 sa_ipv6;
     bool is_ipv4 = inet_pton(AF_INET, ip.c_str(), &(sa_ipv4.sin_addr));
     bool is_ipv6 = inet_pton(AF_INET6, ip.c_str(), &(sa_ipv6.sin6_addr));
     return is_ipv4 || is_ipv6;
   }
   ```
   
   And I am curious why we don't function redefinition error because Windows has inet_pton too.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services