MISRA Discussion Forums

Full Version: A Question for a example of Rule8.6
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a question for the Rule8.6 exmaple.

Your guideline has a following example.
/* file3.c */
int16_t j; /* Tentative definition */
int16_t j=1; /* Compliant - external definition */

I make the next exapmle.
Is it correct?

/* file3_2.c */
int16_t m=1; /* Compliant - external definition */ ←is it correct?
int16_t m; /* declaration */ ←is it correct?


Best Regards,
Kumiko Itoh
You are correct. The example on "m" is compliant. Technically "int16_t m;" is a tentative definition that refers to the previous external definition. It is similar to the example "i1" in Example of section 6.9.2 of the C99 standard.