[Top][All Lists]

[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:12:31 +0200

I just understood that 2 minutes ago by looking at the avr-libc source!
First time that I encounter such an environment! I have to go thru all my
code to modify 'char' to 'signed char'.

Well one learns every day with C!

-----Message d'origine-----
De : Dave Hylands [mailto:address@hidden
Envoyé : lundi 6 septembre 2004 19:42
À : Bernard Fouché; address@hidden
Objet : RE: [avr-gcc-list] are signed chars signed :-) ?

Hi Bernard,

> I just do not understand why I get such a warning! Gcc
> 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 ? ;-)

Different compilers (and perhaps even different versions of the same
compiler) can treat char as signed or unsigned. If you really want one or
the other then use the appropriate keyword:

        signed char a;


        unsigned char a;

Then you'll get a specific type rather than the compiler default.

Dave Hylands
Vancouver, BC, Canada

reply via email to

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