Question
Cosmic compiler unexpected result
Posted on February 01, 2013 at 12:05
Hi.
I'm using the Cosmic STM8 compiler (''free'' version, v4.3.9) and it appears to generate unexpected results for the following test :- static char test(unsigned int x, unsigned int y) { return (int)(x - y) < 0; } This function unexpectedly returns 0 when presented with the values x=0x7f80 and y=0x8080. If I modify the function thus is then returns 1 as expected :- static char test(unsigned int x, unsigned int y) { x -= y; return (int) x < 0; } Am I misunderstanding what the result should be ? P.