gcc - Winsock2.h: FD_SET: comparison between signed and unsigned integer expressions -


excerpt winsock2.h:

#define fd_set(fd, set) { u_int __i;\ (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\     if (((fd_set *)(set))->fd_array[__i] == (fd)) {\         break;\     }\ }\ if (__i == ((fd_set *)(set))->fd_count) {\     if (((fd_set *)(set))->fd_count < fd_setsize) {\         ((fd_set *)(set))->fd_array[__i] = (fd);\         ((fd_set *)(set))->fd_count++;\     }\ }\ } while(0) 

i passing in fd of type int , set of type fd_set *. looks cause of warning may originate #define fd_setsize. excerpt same header:

#ifndef fd_setsize #define fd_setsize  64 #endif 

i redefined fd_setsize 64u prior including winsock2.h doesn't seem fix it.

fd should of type socket u_int.

the relevant line macro was:

if (((fd_set *)(set))->fd_array[__i] == (fd)) {

didn't occur me == comparison operator whatever reason.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -