The Microsoft C compiler warns when you try to compare two variables, and one is signed, and the other is unsigned. For example:
int a;
unsigned b;
if ( a < b ) { // warning C4018: '<' : signed/unsigned mismatch
}
Has this warning, in the history of the world, ever caught a real bug? Why's it there, anyway?
A signed unsigned mismatch is an error that can be caused when one or more variables are incorrectly cast. In C++, integer types are represented as sign-and-magnitude integers.
Turn off the warning for a project in Visual StudioSelect the Configuration Properties > C/C++ > Advanced property page. Edit the Disable Specific Warnings property to add 4996 . Choose OK to apply your changes.
Warnings must not be ignored. You'd better fix every possible error before starting software testing. You may waste much time and effort to find an error in the debugger, although the compiler gives you an explicit warning about it.
Never ignore compiler warnings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With