Rule 8.6: External declaration without definition

Moderators: misra-c, david ward

Post Reply
Polyspacer
Posts: 2
Joined: Thu Aug 21, 2014 6:27 am
Company: Daimler AG

Rule 8.6: External declaration without definition

Post by Polyspacer » Tue Jun 16, 2015 1:10 pm

I have a header file MISRA_8.6.h, in which a variable is declared:

Code: Select all

extern signed short int Variable;
And I have the corresponding c-file MISRA_8.6.c, which uses the variable as input.

Code: Select all

#include "MISRA_8.6.h"

signed short int A; 

void main(void) 
{

	/*8.6*/
    A = Variable;
	
}
The c-file defining the variable is out of scope. Is rule 8.6 violated by this setting or is another rule 8.x violated?

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

Re: Rule 8.6: External declaration without definition

Post by misra-c » Thu Jun 25, 2015 9:05 am

Rule 8.6 covers the situation when there is no external definition present in the set of files being analysed. Therefore "Variable" will violate rule 8.6.
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.8 Declarations and defnitions”