The TI compiler does not give a warning due to the comparison between signed and unsigned integers.
Why?
This same code compiled using other compilers such as the visual C compiler will generate a warning.
Is there a way to have the compiler generate a diagnostic warning message?
static unsigned long
foo(void) {
int i=-1;
unsigned int j = 100;
volatile unsigned long gt = 0;
volatile unsigned long lte = 0;
while ( i != 0) {
if ( i > j) {
gt++;
} else {
lte++;
}
i--;
}
return gt;
}
The following web location lists all the available diagnostic warning/errors/ remarks messages output by the TI 3.2 version of the compiler. http://processors.wiki.ti.com/images/6/60/TICompiler_MSP430_ErrorList.pdf
There is no compiler warning for a "comparison between signed and unsigned integers" listed.
Just a recommendation, This list may prove to be more useful as an appendix in the slau132g "MSP430 Optimizing C/C++ compiler user's guide".