On Fri, Mar 27, 2009 at 4:31 PM, Graham Davies
<address@hidden> wrote:
David VanHorn wrote:
"Ok, so that leaves me VERY confused."
Maybe it would help to think about logic levels in simulation. The three basic levels are "low", "high" and "unknown". The three variations of the char type are similar, signed, unsigned and unspecified. I think that the reason the unspecified variant of char got into the C language definition was political, not technical. The other basic integer types don't share this quirk.
Right, the unspecified variant looks like a disaster waiting to happen, IMHO.
The compiler is probably warning you because a signed char and an unsigned char are both different from an unspecified or plain char, just like low and high are different from unknown.
Ok, but using the portable types, there does not appear to be an unspecified char, which seems like a very good idea to me.
The reason that a function would take a char of unspecified signedness is that the writer of the function reasons that only the least significant seven bits mean anything, so why bother with what the MSB does. I think it's kind-of traditional that 7-bit ASCII is represented as a plain char. Personally, I use uint8_t.
Right, and that's what makes the most sense to me, ASCII is unsigned, so unsigned char should be right, but the routine apparently requires signed!
Previously, I was using the "unsigned char" and "signed char" forms, and the "unsigned char" form gave me warnings.. So I used "signed char", which satisfied the compiler...
Now I'm in the situation where I can't seem to satisfy it with signed or unsigned, in the "uint8_t" and "int_t" forms.
I don't want to cast aspersions, but it seems to me like lcd_puts is buggy, if it's requiring sign.
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list