This may be something I missed in the C standard, but I am not getting the expected result.
static long temp_long; //static because linker has SP INFO incorrect warning
temp_long=99999;
//snip
//.
//.
//snip
//debugger gives temp_long is 99999 in base 10 right here
temp_long=temp_long+(long)50;
//debugger gives correct value of 10049 for temp_long
temp_long=temp_long/(long)100;
//debugger says temp_long is now 66536
//thats 1000+65536 which looks like a problem mixing ints and longs
What did I miss about integer division of longs in K&R or the C standard?
I am using Codewarrior 3.1 for HCS12.
Message Edited by CrasyCat on 2007-04-13 11:26 AM