I'm trying to compile some very bad code that gives me dozens of warnings like:
for code such as:Code:warning C4018: '>=' : signed/unsigned mismatch
and I'm wondering what the best way to get rid of these warnings?Code:if ( wcslen(comma) >= bufLen )
I can't make bufLen unsigned because it would break the API that's already used by many different products.
I can see 3 choices:
- Use a #pragma to disable the warning, but that's just sloppy and compiler specific.
- Cast the unsigned int to an int.
- Cast the int to an unsigned int.
Do I just flop a coin about which side to cast, or is one choice better than the other?