This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c/2102: no warning when comparing (unsigned int) with (int)


 > A little program :
 > -----
 > #include <stdio.h>
 > int main(int argc, char ** argv)
 > {
 > int val ;
 > 
 > val = -1 ;
 > if (val < sizeof(long)) {
 > printf("%d < %d\n", val, sizeof(long));
 > }
 > else {
 > printf("BUG %d >= %d\n", val, sizeof(long));
 > }
 > return(0);
 > }
 > ------
 > Compiling :
 > gcc -Wall tst.c   -o tst 
 > -> NO WARNING printed
 > Exec :
 > ./tst
 > Result :
 > BUG -1 >= 4

Sign compare warnings are activated with -W, not -Wall.

Please read the relevant portions of the gcc manual.

http://gcc.gnu.org/onlinedocs/gcc_3.html#SEC10

--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]