This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/2102: no warning when comparing (unsigned int) with (int)
- To: philippe dot jouguet at vdldiffusion dot com
- Subject: Re: c/2102: no warning when comparing (unsigned int) with (int)
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 26 Feb 2001 14:11:44 -0500 (EST)
- Cc: gcc-bugs at gcc dot gnu dot org
> 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