I thought that the max value for UInt16 is 2^16-1 = 65535. Your first
value is larger than that. Didn't the compiler warn of an integer
overflow?
On Tue, May 01, 2001 at 10:04:23AM -0500, David Leland wrote:
> I have an array defined as follows:
>
> static UInt16 baudRate[] = {
> 115200,
> 57600,
> 38400,
> 28800,
> 19200,
> 14400,
> 9600,
> 4800,
> 2400,
> 1200,
> 600,
> 300
> };
>
> However, when I try to do something with these array values, I don't get the
> values listed in the array but instead get different values. 57600 returns
> 0, 38400 returns 4096, 28800 returns 0, 19200 returns 44152, 14400 returns
> 0, 9600 returns 127, 4800 returns -5177343, 2400 returns 291908, 600 returns
> 250446, 300 returns 259140 and 115200 and 1200 both return a number that is
> either greater than or less than the value that can be stored in a UInt16.
>
> When I look at the array in debug, it has the correct values but if I try to
> do anything with it (i.e. write the values to a list), the values are always
> wrong.
>
> I know that this same problem was reported by someone else back in Nov. 2000
> (using g++) and no one came up with an answer. Well, this just has me
> stumped and I would sure appreciate it someone could tell me what was going
> on, or at least where to go to find out the answer.
>
> Dave
--
Jeffery D. Collins, Ph.D.
Sr. Software Developer
Endeavors Technology, Inc.
http://www.endeavors.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/