sdkdwyb的个人空间 https://bbs.21ic.com/?788420 [收藏] [复制] [RSS]

日志

转:【IAR警告】Warning[Pa082]: undefined behavior: the order of volatile accesse ...

已有 420 次阅读2016-3-28 22:05 |个人分类:学习笔记|系统分类:兴趣爱好




Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement



 



运算符两边都是volatile变量的警告



 



这警告有意义.



用volatile修饰的变量一般不直接参与运算,volatile就以为这个变量在运算过程中有可能已经改变了



建议使用另外一个变量参与计算:

例如:想计算a * b 要这样:



volatile unsigned char a;
volatile unsigned char b;

unsigned char x,y;

x = a;
y = b;

return (x * y);

   

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)