Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rule 13.2: are const volatile variables volatile or not?
#2
The above initialization is compliant with rule 13.2, but it is assumed that the question refers to the use of "myvar" in other expressions.

"myvar" should then be considered as having a volatile-qualified type. For example:
Code:
const volatile uint8_t myvar = 0;
  volatile uint8_t var2 = 0;
  uint8_t x = 3;
  uint8_t y;
  
  y = var2 + x;      // compliant - one read access of volatile-qualifed type.
  y = var2 + myvar;  // non-compliant - more than one read access of volatile-qualified type.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)