David VanHorn <[email protected]> wrote:
> Recently, I've converted to the portable typedefs as
>
> unit8_t and int8_t
There's no point in converting "char" (as in: displayable character,
rather than: small integer number used in calculations) to anything
else but "char". Displaying a char is the exact reason it has been
designed for, so just write it as "char", without any need to care
whether it is implemented as a signed or unsigned data type.
For anything you're doing calculations with, use int8_t or uint8_t.
Usually, when you're in the controller business, there's exactly one
transition between uint8_t and char: the lower hardware layer itself.
If you want, apply an explicit typecast there:
void lcd_putchar(char c)
{
...
LCD_DATA_PORT = (uint8_t)c;
}
Anything above that should use just "char", and be happy with it.
String literals are of the implied type "const char *" (well, rather
just "char *" for hysterical raisins, but better treat them as "const
char *"), and again, the signedness of the small integers that
represent the underlying character set should never matter to you.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list