zoukankan      html  css  js  c++  java
  • 【IAR警告】Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined

    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);


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

    volatile char VVV = 9;

    char fun()
    {
    char xxx;
    char yyy = 9;

    xxx = VVV;
    return xxx * yyy
    }



  • 相关阅读:
    树的同构
    最大子列和
    多项式的表示和运算
    图1
    集合及运算
    树4
    树3
    树2
    期末作业验收
    个人总结
  • 原文地址:https://www.cnblogs.com/pang123hui/p/2309831.html
Copyright © 2011-2022 走看看