Why are the results of integer promotion different?
问题 Please look at my test code: #include <stdlib.h> #include <stdio.h> #define PRINT_COMPARE_RESULT(a, b) \ if (a > b) { \ printf( #a " > " #b "\n"); \ } \ else if (a < b) { \ printf( #a " < " #b "\n"); \ } \ else { \ printf( #a " = " #b "\n" ); \ } int main() { signed int a = -1; unsigned int b = 2; signed short c = -1; unsigned short d = 2; PRINT_COMPARE_RESULT(a,b); PRINT_COMPARE_RESULT(c,d); return 0; } The result is the following: a > b c < d My platform is Linux, and my gcc version is 4.4