此问题在IAR中的开发文档中有明确的叙述,请在文档中查找“INTEGER TYPES AND BIT NEGATION”,看看相关的叙述,你就会明白你所说的问题该如何解决了。先摘录其中部分文字如下:
void F1(unsigned char c1)
{
if (c1 == ~0x80)
;
}
Here, the test is always false. On the right hand side, 0x80 is 0x0000
~0x00000080 becomes 0xFFFFFF7F. On the left hand side, c1 is an
character, so it cannot be larger than 255. It also cannot be nega tive, w
the integral promoted value can ne ver have the topmost 24 bits set.