I don’t manage to remove a warning C4018: '<' : signed/unsigned mismatch from this code:
SOCKET s;
fd_set set;
FD_CLR(s,&set);
It seems to me that the problem is inside the implementation of VS2005’s FD_CLR, and actually it’s not a big issue, just quite annoying. Is there a portable equivalent version of this code that doesn’t produce warnings?
(NOTE: I know that there is a #pragma to turn off the warning. I also know that the FD_CLR macro actually works perfectly. I am just looking for a way to write the code without warnings)
EDIT: Eventually, I have discovered what is going on: a third-party .h contains a (WRONG!!!) redefinition of “u_int” as “int”. That’s why the compiler complains for a comparison between u_int inside the FD_CLR. Shame on me.
Instead of disabling the warning globally, or locally every time you call
FD_CLR(), perhaps write a wrapper for that call that disables that particular warning locally for you.