Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What operators are prohibited/allowed by rule 12.13?
#3
(1) (*p)++; /* Compliant */
(2) a[i]++; /* Compliant */
(3) my_struct.member++; /* Compliant */
(4) my_struct_ptr->member++; /* Compliant */

(5) a = b++; /* NOT Compliant */
(6) pop_value = buffer[--index]; /* NOT Compliant */
(7) buffer[index++] = push_value; /* NOT Compliant */
(8) *p1++ = *p2++; /* NOT Compliant */

(9) do { ... } while ((i--) > 0); /* NOT Compliant */

(10) sum += buffer[i++]; /* NOT Compliant */

When the increment or decrement operator is used, it shall be the only side-effect in the expression and the result shall not be used within that expression.

This will be clarified in Technical Clarification 1.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)