[Cortex-M0技术交流] IAR编译过程中的问题

[复制链接]
2432|3
 楼主| _crystal_ 发表于 2012-8-3 09:41 | 显示全部楼层 |阅读模式
芯片:MO58
编译环境:IAR630,无优化
见下图,编译后重要语句被省略

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
X-Hawk 发表于 2012-8-3 13:48 | 显示全部楼层
看起来 if(tmp8 != (~tmp8B)) 这句没有了?

这句是不是任何情况下都成立的?
tmp8和tmp8B 各是什么类型?
 楼主| _crystal_ 发表于 2012-8-4 10:30 | 显示全部楼层
tmp8 和 tmp8B是都是uint8_t类型,串口接到到的数据。前后两次接收到的数据进行比较
haohao96 发表于 2012-10-24 17:56 | 显示全部楼层
此问题在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.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

36

主题

131

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部