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: Joerg Wunsch
Subject: Re: [avr-gcc-list] Re: Passing a string variable to lcd_puts
Date: Mon, 30 Mar 2009 19:05:53 +0200 (MET DST)

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.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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