Can I make GCC warn on passing too-wide types to functions?
问题 Following is some obviously-defective code for which I think the compiler should emit a diagnostic. But neither gcc nor g++ does, even with all the warnings options I could think of: -pedantic -Wall -Wextra #include <stdio.h> short f(short x) { return x; } int main() { long x = 0x10000007; /* bigger than short */ printf("%d\n", f(x)); /* hoping for a warning here */ return 0; } Is there a way to make gcc and g++ warn about this? On a side note, do you have another compiler which warns about