From: j...@uriah.heep.sax.de

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

 

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Ā®.
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to