avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Passing a string variable to lcd_puts


From: David VanHorn
Subject: Re: [avr-gcc-list] Passing a string variable to lcd_puts
Date: Fri, 27 Mar 2009 16:44:08 -0400



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.
 
 
Graham.
 

_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




--
David VanHorn
Hardware Engineer
MobileFusion, Inc
2715 Sarah St
Pittsburgh PA, 15203
Phone: (001) 412-481-1111
Cell: (001) 765-215-8521
Fax: (001) 412-481-0220
address@hidden
www.mobilefusioninc.com

****************************************************************************
This communication (including any attachments) is for the use of the
intended recipient(s) only and may contain information that is
confidential, privileged or otherwise legally protected. Any
unauthorized use or dissemination of this communication is
prohibited. If you have received this communication in error, please
immediately notify the sender by return e-mail message and delete
all copies of the original communication. Thank you for your
cooperation.
****************************************************************************

reply via email to

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