Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 19.9 - incorrect comment in mc2_1909.c?
#1
mc2_1909.c contains following code:
Code:
#define SUM(A,B,C) ((A) + (B) + (C)) /* Violates Rule 17.4 */

Rule 17.4 is "Array indexing shall be the only allowed form of pointer arithmetic." - the code does not seem to be violation of this rule.
Reply
#2
Code:
#define SUM(A,B,C) ((A) + (B) + (C)) /* Violates Rule 17.4 */
The comment above is incorrect. This is a function-like macro which violates rule 19.7.

Code:
mc2_1909_s16a = SUM( 5,
#ifdef SW
                        mc2_1909_s16b,
#else
                        mc2_1909_s16c,
#endif
                        0 );
The above lines should be flagged as a violation of Rule 19.9.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)