【IAR警告】Warning[Pa082] -
来源: 网络用户发布,如有版权联系网管删除 2018-09-07
[导读]Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement运算符两边都是volatile变量的警告这警告有意义.用volatile修饰的变量一般不直接参与运算,volatile就以为着这
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
本文引用地址: http://www.21ic.com/app/mcu/201808/783604.htm
运算符两边都是volatile变量的警告
这警告有意义.
用volatile修饰的变量一般不直接参与运算,volatile就以为着这个变量在运算过程中有可能已经改变了
例如:想计算a * b 要这样:
volatileunsignedchara;volatileunsignedcharb;unsignedcharx,y;x=a;y=b;return(x*y);
建议使用另外一个变量参与计算:
volatilecharVVV=9;charfun(){charxxx;charyyy=9;xxx=VVV;returnxxx*yyy}
查看评论 回复
"【IAR警告】Warning[Pa082] -"的相关文章
- 上一篇:单片机 C 语言模块化编程 -
- 下一篇:STC89C52中断系统 -