[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Passing a string variable to lcd_puts
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Passing a string variable to lcd_puts |
Date: |
Sat, 28 Mar 2009 18:10:17 +0100 (MET) |
David VanHorn <address@hidden> 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. ;-)
- Re: [avr-gcc-list] Re: Passing a string variable to lcd_puts, (continued)
- RE: [avr-gcc-list] Re: Passing a string variable to lcd_puts, Dave Hansen, 2009/03/30
- RE: [avr-gcc-list] Re: Passing a string variable to lcd_puts, Dave Hansen, 2009/03/30
- [avr-gcc-list] Re: Passing a string variable to lcd_puts, David Brown, 2009/03/30
- Re: [avr-gcc-list] Passing a string variable to lcd_puts, Graham Davies, 2009/03/27
- Re: [avr-gcc-list] Passing a string variable to lcd_puts, David VanHorn, 2009/03/27
- Re: [avr-gcc-list] Passing a string variable to lcd_puts, Graham Davies, 2009/03/27
Re: [avr-gcc-list] Passing a string variable to lcd_puts,
Joerg Wunsch <=
[avr-gcc-list] Re: Passing a string variable to lcd_puts, David Brown, 2009/03/30