A Question for a example of Rule8.6

Moderators: misra-c, david ward

Post Reply
Posts: 6
Joined: Thu Feb 20, 2014 6:48 am
Company: HitachiAutomotiveSystems

A Question for a example of Rule8.6

Post by KumikoItoh » Tue Feb 25, 2014 5:50 am

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

Posts: 571
Joined: Thu Jan 05, 2006 1:11 pm

Re: A Question for a example of Rule8.6

Post by misra-c » Fri Mar 14, 2014 8:40 am

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.
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.8 Declarations and defnitions”