Page 1 of 1

A Question for a example of Rule8.6

Posted: Tue Feb 25, 2014 5:50 am
by KumikoItoh
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

Re: A Question for a example of Rule8.6

Posted: Fri Mar 14, 2014 8:40 am
by misra-c
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.