标题: 搞定Warning[Pa082]: undefined behavior: the order of volatile accesses is und... [打印本页]

作者: heicad    时间: 2014-5-20 16:02
标题: 搞定Warning[Pa082]: undefined behavior: the order of volatile accesses is und...
今天搞定了一个小错误,使用IAR编译时使用2个volatile变量在同一语句时出如下警告
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement

查资后得知原因是:volatile变量一般使用在多线程等场合,如果同一语句使用2个此变量,会出现访问顺序不可预知的后果,所以要解决此问题可以把其中一个先读取存放到一个局部变量中,再和另一个进行运算.





欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1