in following program, line 5 give overflow warning expected, surprisingly line 4 doesn't give warning in gcc: http://www.ideone.com/u0bxn int main() { int = 256; char c1 = i; //line 4 char c2 = 256; //line 5 return 0; } i thinking both lines should give overflow warning. or there i'm missing? the topic led me experiment this: typedef type checking? there said following(which deleted answer, because when run it, didn't show had expected): //however, you'll warning case: typedef int t1; typedef char t2; t1 x = 256; t2 y = x; //possible overflow warning! (but doesn't give warning :() -wall doesn't include many options. -wconversion 1 of them , warns behavior you're interested in. see http://gcc.gnu.org/onlinedocs/gcc/warning-options.html
Comments
Post a Comment