Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.8 clarification
#2
Code:
static void xyz();
void xyz() { .. }
In the first line "xyz" is declared with internal linkage in. In the second line the declaration of "xyz" takes the same linkage as the prior declaration which in this case is internal linkage. [See C99: Section 6.2.2 paras 4 and 5 ]
Both declarations therefore have internal linkage. This is well-defined in C, but violates rule 8.8.

Code:
void xyz();
static void xyz() { .. }
In the first line "xyz" is declared with external linkage, whereas in the second line "xyz" is declared with internal linkage. This is undefined behaviour [ C90: Undef 8, C99: Undef 7 ] and is a violation of rule 1.3
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)