FridgeFreezer

When does 0xFF != 0xFF - strange behaviour in CW7.2

Discussion created by FridgeFreezer on Sep 10, 2010
Latest reply on Sep 11, 2010 by CompilerGuru

Device is MCF52259 144LQFP, CW is 7.2, code is C.

 

I have just had a strange problem in a routine, something like this:

 

#define MATCH 0xFF

 

myfunc(char ch)
{

       if(ch == MATCH)

       {

        do_something();

        }

}

 

Yet when I pass 0xFF to it, it doesn't evalute TRUE unless I do this:

 

#define MATCH 0xFF

 

myfunc(char ch)
{

       if(ch == (char)MATCH)

       {

        do_something();

        }

}

 

This code previously worked absolutely fine in our old project in CW5.9 / MMC2114

 

Anyone got any clues? Have I got to change the compiler config or something?

Outcomes