> I haven't tested this using the Metrowerks or GCC-for-Palm
> yet, but on other systems I have had problems testing unsigned
> variables against signed constants.  Basically -1 != 65535 when
> comparing the values.

When you write the literal -1, it'll be an int because it doesn't have any
suffix indicating its type and it isn't big enough to require a long.
Typically, Palm OS applications are compiled with 2 byte ints, so this is
equivalent to 0xFFFF. However, if you tell your compiler to use 4 byte ints,
this will be equivalent to 0xFFFFFFFF, which is not equal to the _unsigned_
16 bit value 0xFFFF.

So, unless you have a really good reason, stick with 2 byte ints. If you
have to use 4 byte ints, be careful.

I filed a bug for all the places the docs use "-1" for an unsigned type.
-
Danny

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to