Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What about Macros for 14.3?
#3
Quote:
Code:
#define M1 ;


This macro breaks rule 19.4. Macro expanding to Null statement is not allowed.

Code:
#define M2
#define M3 /* comment */


This macro expands to no body, and is therefore not prohibited by 19.4.

A comment in a macro definition is removed by the pre-processor. Rule 14.3 applied before
Pre-processing. Treatment of M2 and M3 is identical.

Code:
M1


Since definition of M1 macro was invalid, its use is already a violation.

Code:
M2;
M3;

After pre-processing, these are both Null statements. Before pre-processing, there are characters before the Null statement. This is not allowed by 14.3.

Re-posted under offical user name only.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)