> ULong answer;
> int valueA;
> Word valueB;
>
> answer -= (valueA * valueB);
>
> (note the "minus equals")
>
> How does the compiler know what type to make the answer of the
> multiplication?  If valueA = 660 and valueB = 100, the answer is larger
than
> an int.  Will the complier automatically use a long int to store the
answer
> before doing the subtraction?

No. The compiler decides the type of the operation according to the type of
the operands, not the type of the result. You can force the compiler to
generate a 32 bits multiplication by making one of the operand a long :

answer -= ((long) valueA * valueB);

Pascal Levy



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