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

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

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


From: Dave Hansen
Subject: RE: [avr-gcc-list] Re: Passing a string variable to lcd_puts
Date: Mon, 30 Mar 2009 16:12:17 -0400

 From: address@hidden

> Dave Hansen <address@hidden> wrote:
>
> > In this code=2C the handle_input function falls into an infinite loop if pl=
> > ain char is signed. This is because key gets promoted (to signed int) befo=
> > re the comparison with EXIT_KEY (which is already signed int). If plain c=
> > har is signed=2C and key is 0xF1=2C the sign is extended for key=2C but not=
> > EXIT_KEY.
>
> I didn't try it, but wouldn't the correct solution be to declare
>
> #define EXIT_KEY ((char)0xF1)
>
> That way, EXIT_KEY must be promoted by the same rules, and the
> comparison ought to work again.
 
That would work.  Another way is to have get_key return int.
 
Regards,
 
   -=Dave
 


Express your personality in color! Preview and select themes for HotmailĀ®. See how.

reply via email to

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