[previous] 3673 [next] The object addressed by the pointer parameter '%s' is not modified and so the pointer could be of type 'pointer to const'.
Pointers

This function parameter is a pointer which is never used to modify the data which it addresses. In other words, it is an "input" parameter. It would therefore improve clarity to declare it as a pointer to a const qualified type.

Consistent use of the const type qualifier can help to improve clarity and protect against possible misuse of objects.

For example:


/*PRQA S 506,553,2017,3227,3408 ++*/

extern void foo (
    int *pir,                   /* Message 3673 */
    int *piw )                  /* No message   */
{
    int x;

    x = *pir;                   /* pir is used for input  */
    *piw = x;                   /* piw is used for output */
}

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