[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] are signed chars signed :-) ?
From: |
Bernard Fouché |
Subject: |
[avr-gcc-list] are signed chars signed :-) ? |
Date: |
Mon, 6 Sep 2004 19:19:51 +0200 |
Hi there.
If I write the following code, the compiler (3.4.1) is happy:
void f(void)
{
char a;
a=-3;
if(a>0)
printf("Hello\n");
}
However if I change the test to:
if(a>=0)
printf("Hello\n");
then the compiler complains :
file.c:<line number>: warning: comparison is always true to limited range of
data type.
I just do not understand why I get such a warning! Gcc 3.3.2.1 on Linux
groks the function without complaining with -Wall. 'a' being signed, I feel
I have the right to compare it to being greater or equals to zero, no ? ;-)
I looked at http://gcc.gnu.org/bugzilla with the string 'avr', found 5 bugs
currently opened, went thru the old bugs and found nothing.. I must be
missing something obvious! (time to go to sleep ? :-))