Excerpt from winsock2.h:
#define FD_SET(fd, set) do { u_int __i;\
for (__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 am passing in fd of type int and set of type fd_set *. It looks like the cause of the warning may originate from the #define for FD_SETSIZE. Another excerpt from the same header:
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
I redefined FD_SETSIZE to 64U prior to including winsock2.h but this doesn’t seem to fix it.
fdshould be of typeSOCKETwhich isu_int.The relevant line from the macro was:
if (((fd_set *)(set))->fd_array[__i] == (fd)) {Didn’t occur to me that
==is a comparison operator for whatever reason.