27-04-2006, 10:35 AM
(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.
(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