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

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;

Or

        unsigned char a;

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

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/



reply via email to

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