[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            */
{
}

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents