Hi All, I don't believe this is actually a bug, but can anybody explain why this code works correctly
void func(int v1, int v2){ unsigned char code tbl[] = {'a', 'b', 'c', 'd', 0, '1', '2', '3', '4'}; signed char xdata diff = v1 - v2; if (diff >= -4 && diff <= 4) printf("%c\n", tbl[diff + 4]); }
void func(int v1, int v2){ unsigned char code tbl[] = {'a', 'b', 'c', 'd', 0, '1', '2', '3', '4'}; int xdata diff = v1 - v2; if (diff >= -4 && diff <= 4) printf("%c\n", tbl[diff + 4]); }
Well, I have no other explanation. Could you let us know what version of the compiler you are using? Version 7.01. Is that the latest one?
"Version 7.01. Is that the latest one?" 7.20 is the latest. Maybe someone who uses a more recent version than 7.01 could check whether this has been fixed?