[previous] MISRA-C:2004  Rule  8.6:  (Required) [next] Functions shall be declared at file scope.
Declaring functions at block scope may be confusing, and can lead to undefined behaviour.

Example Code:


/* PRQA S 3408,3447 ++ */

#include "misra.h"
#include "m2cmex.h"

extern S16 test_0806( void )
{
   extern S16 test_0806a( void );        /* MISRA Violation */
   S16 r;

   r = test_0806a();

   return r;
}

extern S16 test_0806a( void )            /* MISRA Violation - Rule 8.8 */
{
   return 1;
}


QAC messages that encompass this guideline:

3221 Function with external linkage declared at block scope.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents