Steve Hay wrote:
..\util.c(4582) : warning C4018: '==' : signed/unsigned mismatch
..\util.c(4583) : warning C4018: '==' : signed/unsigned mismatch
These warnings have been happening since change #26189, which causes
winsock2.h to be used rather than winsock.h.
The warnings concern the lines
FD_SET(sockets[0], &rset);
FD_SET(sockets[1], &rset);
where
int sockets[2] = {-1, -1};
They have cropped up now because the old winsock.h defined
#define FD_SET(fd, set) do { \
if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) \
((fd_set FAR *)(set))->fd_array[((fd_set FAR
*)(set))->fd_count++]=(fd);\
} while(0)
whereas the new winsock2.h says
#define FD_SET(fd, set) do { \
u_int __i; \
for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \
if (((fd_set FAR *)(set))->fd_array[__i] == (fd)) { \
break; \
} \
} \
if (__i == ((fd_set FAR *)(set))->fd_count) { \
if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \
((fd_set FAR *)(set))->fd_array[__i] = (fd); \
((fd_set FAR *)(set))->fd_count++; \
} \
} \
} while(0)
The == causes the warning because set->fd_array are SOCKETs, which are
unsigned, whereas UNIX sockets are signed.
MSDN speaks about this problem here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/socket_data_type_2.asp
but that's more about how to change UNIX software to compile cleanly on
Windows, not how to make it clean on both.
Can anyone see how to do it, other than introducing #ifdef WIN32 etc?
------------------------------------------------
Radan Computational Ltd.
The information contained in this message and any files transmitted with it are
confidential and intended for the addressee(s) only. If you have received this
message in error or there are any problems, please notify the sender
immediately. The unauthorized use, disclosure, copying or alteration of this
message is strictly forbidden. Note that any views or opinions presented in
this email are solely those of the author and do not necessarily represent
those of Radan Computational Ltd. The recipient(s) of this message should check
it and any attached files for viruses: Radan Computational will accept no
liability for any damage caused by any virus transmitted by this email.