Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

MISRA.FUNC.PARAMS.IDENT

Identifiers used in declaration and definition of function are not identical.

MISRA-C Rule 16.4 (required): The identifiers used in the declaration and definition of a function shall be identical.

Functions shall be declared with a return type (see Rule 8.2), that type being void if the function does not return any data. Similarly, if the function has no parameters, the parameter list shall be declared as void. Thus for example, a function, 'myfunc', which neither takes parameters nor returns a value would be declared as:

void myfunc ( void );

MISRA-C++ Rule 8-4-2 (required): The identifiers used for the parameters in a redeclaration of a function shall be identical to those in the declaration.

This rule is also covered by MISRA.ADDR.REF.PARAM.PTR.

Rationale

The name given to a parameter helps document the purpose of the parameter within the function body. If a function parameter is renamed in a subsequent re-declaration, then having different names for the same object will probably lead to developer confusion.

Note that the rule also applies to any overriding set.

Exception

It is not a violation of this rule if the declaration or re-declaration contains an unnamed parameter.

Example

// File1
void CreateRectangle ( uint32_t Height, uint32_t Width );

// File2
// Non-compliant
void CreateRectangle ( uint32_t Width, uint32_t Height );

void fn1 ( int32_t a );
void fn2 ( int32_t   );

void fn1 ( int32_t b ) // Non-compliant
{
}

void fn2 ( int32_t b ) // Compliant
{
}