![]() |
|
MISRA-C:2004 Rule 8.1: (Required) |
|
||||
![]() | |||||||
The recommended method of implementing function prototypes for external functions is to declare the function (i.e. give the function prototype) in a header file, and then include the header file in all those code files that need the prototype (see Rule ).
The provision of a prototype for a function with internal linkage is a good programming practice.
Example Code:
/* PRQA S 3210 ++ */
#include "misra.h"
#include "m2cmex.h"
static S16 test_0801a( a ) /* MISRA Violation Rule 8.1 */
S16 a;
{
return a;
}
extern S16 test_0801( void )
{
S16 r;
r = test_0801a( 1 );
r = r + test_0801b( ); /* MISRA Violation Rule 8.1 */
return r;
}
QAC messages that encompass this guideline:
| 3002 | Defining '%s()' with an identifier list and separate parameter declarations is an obsolescent feature. |
| 3335 | No function declaration. Implicit declaration inserted: 'extern int %s();'. |
| 3450 | Function '%s', with internal linkage, is being defined without a previous declaration. |
|
||
(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 |