Wolfgang Grosche

Implicit cast

Discussion created by Wolfgang Grosche on Dec 18, 2006
Latest reply on Dec 19, 2006 by Daniel Lundin
I am using ANSI-C/cC++ Compiler for HC12 V-5.0.28 Build 5073
and I am looking for a compiler option to solve the following problem:
unsigned long lResult; // 32bit
unsinged int iFac1 = 0x1000, iFac2 = 0x1000; // 16bit

lResult = iFac1 * iFac2;
So, lResult should hold the 32bit result of the multiplication. Actually its only an 16bit value, which I fully agree with, but I need to know whether its possible to assign the correct 32bit result to lResult without casting.
Typecasting one of the Factors it not an option for me, due to some difficult reasons!

Is there a way that the compiler can recognize the 32bit type of lResult and apply this knowlege to the computation of the R-value before assignment?