[previous] 3675 [next] Function parameter declared with type qualification which differs from previous declaration.
Functions

This function parameter has not been declared with the same type qualification as used in a previous declaration.

This is allowed in ISO:C but is inconsistent and therefore unhelpful.

Applying the const qualifier to a parameter in the prototype will make no semantic difference to the function interface when the function is called. But, notice that there is a much more serious inconsistency which occurs if the parameter is a pointer and the type addressed by the pointer is not declared with the same type qualifiers.

For example:


/*PRQA S 3206,3408,3447,3602 ++*/

extern void func1(int x);
extern void func2(const int *pci);

extern void func1(const int x)         /* Message 3675 - inconsistent but legitimate */
{
}

extern void func2(int *pci)            /* Message 0627 - constraint error            */
{
}


MISRA-C:2004 Rules applicable to message 3675:

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.


QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents