Well, to my knowledge, CCS C is an Ansi compiler. If so, it should follow the ansi C spec. IIRC, when doing a comparison between two variables which are not explicitly cast, they are both converted to the 'next higher' variable, which would be a signed long. If that was the case, your comparison would be fine. Since that is not the case, than one of my two assumptions are incorrect (either CCS is not ansi in this respect, or ANSI does not require a specific method of casting variables when doing compare operations). At any rate, since you know that your signed int cannot possible ever go above 250, why even make the comparison? I'm assuming it's just to demonstrate the problem. Is there a reason why you can't define them both as the same type of variable? -Adam Lawrence Lile wrote: > > In CCS C, I've got the following statements: > > int SlopeSetpt = 250; > Signed int Slope = 0; > > . > . > . > . > > if (slope >= SlopeSetpt){ > > do some code... > > } > > I keep having trouble that the IF statement is true, and executes even > though 0 should be less than 250. > > How would CCS C evaluate this statement given that the two variables are > different types? > > -- Lawrence Lile > Sr. Project Engineer > Salton inc. Toastmaster Div. > 573-446-5661 Voice > 573-446-5676 Fax > > -- > 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.