MISRA Discussion Forums
Rule 8.6: External declaration without definition - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21)
+---- Forum: 8.8 Declarations and defnitions (https://forum.misra.org.uk/forumdisplay.php?fid=163)
+---- Thread: Rule 8.6: External declaration without definition (/showthread.php?tid=1188)



Rule 8.6: External declaration without definition - Polyspacer - 16-06-2015

I have a header file MISRA_8.6.h, in which a variable is declared:
Code:
extern signed short int Variable;

And I have the corresponding c-file MISRA_8.6.c, which uses the variable as input.
Code:
#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?


Re: Rule 8.6: External declaration without definition - misra-c - 25-06-2015

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.