Trevor,
At the time the compiler evaluates an expression, it doesn't take into account the
type of the storage you'll ultimately be putting it into. That means that the
compiler doesn't know that "1 << 16" will be put into an Int32. Therefore, it
evaluates the expression based on the types at hand: 1, which is an int, and 16, which
is an int. The result will be an int. Since the int is 16 bits on Palm 68K, and
since "1 << 16" doesn't fit in a 16-bit value, you get the warning message.
To avoid the warning, use one of the following:
Int32 value = 1L << 16;
Int32 value = ((Int32) 1) << 16;
-- Keith
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Trevor
> Powell
> Sent: Saturday, February 07, 2004 8:10 PM
> To: Palm Developer Forum
> Subject: Int32 only 16 bits?
>
>
> I've just written the following code:
>
> Int32 value = 1 << 16;
>
> Compiling with gcc and PRC-Tools, sdk5-r3, I get the
> following warning:
>
> warning: left shift count >= width of type
>
> Shifting left by 15 doesn't generate the warning. Anybody have a clue
> about what's going wrong, here?
>
> Trevor Powell
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/