Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 10.2 Are increment/decrement compliant
#1
Are the increment and decrement operators on essentially character type allowed?
Code:
char c = ‘A’;
   c++;  /* compliant or not compliant */
Posted by and on behalf of the MISRA C Working Group
#2
  • Rule 10.2 only applies to the binary +, -, += and -= operators.
  • Rule 10.1 permits plain char as an operand to increment/decrement operators, as explained in the sentence "Under this rule the ++ and -- operators behave the same way as the binary + and - operators.
  • Rule 10.4 does not apply to the increment/decrement operator, as explained in the sentence “the increment and decrement operators are not covered by this rule.”
In summary, when taking all the essential type rules together, increment/decrement on essentially character is allowed.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 2 Guest(s)