I just wanted to share a hard to discover bug with other newcomers just
so they stay aware...

It makes sense that on the Palm, ints are 16-bit, not 32-bit.

But what I didn't catch is that in macros, such as:

#define MY_FLAG (32768 << 256)

UInt32 flags |= MY_FLAG;

Everything will act like it's working OK -> in fact, all the normally
"integer math" functions such as (a << b) still work in 32-bits.

But the #defines don't.  The #define above will only contain the low
word of the value, and since you can't see the value of a define in the
debugger, all you notice is that values and branches aren't working
right.

The best way I found around this was just to check the USE 4 BYTE INTS
option.

Cheers!
- Jeff

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