I made short work of it by fixing the code so both variables are the same type. The code worked as expected then. Maybe the compiler guessed at casting the variables to some common type, converting 250 to -6 as you said. Thanks! ----- Original Message ----- From: "Chris Eddy" To: Sent: Monday, October 16, 2000 2:16 PM Subject: Re: Signed Int vs Int > Why not make quick work of it and cast them, for the purpose of sanity check, to > see what is going on. Example; > > if ( (unsigned int)var1 >= (unsigned int) var2 ) > > Then whittle the problem down from there. CCS ought to be ansi, but I believe > that C assumes int (16 bit) by default. That one can sneak up on you subtly, > like when you use a const in amongst some long variables, and it assumes int. > You have to add an L at the end to drive it home. > > 250 would only be -6 if it were treated as a char, or 8 bit. The definition of > short can confuse matters too, as I have seen it applied a few ways. > > Chris Eddy~ > > Lawrence Lile wrote: > > > > > Maybe CCS converts them both to signed INTs. In that case -6 (= 250) would > > really be less than 0. ????? > > > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.