Re: [cc65] Problem with evaluating if with negative numbers

From: S M <san.mes1gmail.com>
Date: 2012-02-03 15:38:27
The program is working fine now since I added "signed" to char as Gábor
told me to do. Thanks


2012/2/3 Joseph Rose <rose.joseph12@yahoo.com>

> Try casting the test number to a signed number, i.e. (signed) or (signed
> char).
> -----------------------
> Joseph Rose, a.k.a. Harry Potter
> Working magic in the computer community
>
>   *From:* S M <san.mes@gmail.com>
> *To:* cc65 <cc65@musoftware.de>
> *Sent:* Friday, February 3, 2012 8:24 AM
> *Subject:* [cc65] Problem with evaluating if with negative numbers
>
> Hello
>
> I had the following line of code
>
> if (bugs[n].mx < 0 ) {...
>
> but it didn't work so I had to change it to:
>
> if ( (bugs[n].mx >=128) && (bugs[1].mx <=255) ) {...
>
> Why the first line doesn't work if .mx is not unsigned ?
>
>
>
>
>

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Feb 3 15:38:36 2012

This archive was generated by hypermail 2.1.8 : 2012-02-03 15:38:39 CET