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.OBJ.TYPE.IDENT

Type not identical with type of other declaration.

MISRA-C Rule 8.3 (required): For each function parameter the type given in the declaration and definition shall be identical, and the return types shall also be identical.

[Undefined 24; Koenig 59—62]

The types of the parameters and return values in the prototype and the definition must match. This requires identical types including typedef names and qualifiers, and not just identical base types.

MISRA-C++ Rule 3-9-1 (required): The types used for an object, a function return type, or a function parameter shall be token-for-token identical in all declarations and re-declarations.

Rationale

If a re-declaration has compatible types but not types which are token-for-token identical, it may not be clear to which declaration that re-declaration refers.

Example

typedef int32_t INT;

        INT i;
extern int32_t i;        // Non-compliant

        INT j;
extern  INT j;           // Compliant

// The following lines break Rule 3—9—2
extern void f ( signed int );
       void f ( int );                // Non-compliant
extern void g ( const int );
       void g ( int );                // Non-compliant