MISRA Discussion Forums

Full Version: Rule 19.9 - incorrect comment in mc2_1909.c?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.