Dave Hansen <i...@hotmail.com> 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. ;-)


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

Reply via email to