Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 12.2: Accessing volatiles in simple assignment statemnt
#5
Just another question on the volatile variables in this rule, as I am implementing the MISRA C 2004 rules for a static analyser (www.frama-c.com). If I interpret the rule literally I have the following:

volatile int v=4;
int x=5;

v+=3; // Not compliant
v=x; // Compliant
x=x+v; // Compliant
x+=v; // Not compliant
x=v+v; // Compliant

Is this correct?
Shouldn't the last assignment be NOT compliant as its rhs causes a side effect?
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)