I have very recently started having problems with the code that codewarrior is generating. The project is a fairly large POL/C++/extend project.
I write the following line of code: UInt32 test = 1024 * 1024;
and it gets assembled in to the following. 0007400C: 7600 moveq #0,d5
1024 * 1024 is 1048576, a number beyond the range of a "int". The hex representation is 0x100000, which truncates to 0 in 16-bit math. C requires that you do math in "int" form unless one of the arguments has a larger representation, in which case you promote the arguments.
UInt32 test = 1024 * 1024;
means
UInt32 test = (UInt32)((Int16) 1024 * (Int16)1024);
You want
UInt32 test = 1024L * 1024L;
explicitly saying your numbers are long to get 32-bit math.
--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
