avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] are signed chars signed :-) ?


From: Bernard Fouché
Subject: RE: [avr-gcc-list] are signed chars signed :-) ?
Date: Mon, 6 Sep 2004 20:08:55 +0200

Well it appears that if I define 'a' as being a 'signed char', that's fine.
But hell, does it mean that all my 'char' in my program are unsigned????

-----Message d'origine-----
De : address@hidden
[mailto:address@hidden la part de Bernard Fouché
Envoyé : lundi 6 septembre 2004 19:20
À : address@hidden
Objet : [avr-gcc-list] are signed chars signed :-) ?


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 ? :-))


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list



reply via email to

[Prev in Thread] Current Thread [Next in Thread]