[previous] 3227 [next] The parameter '%s' is never modified and so it could be declared with the 'const' qualifier.
Declarations and Definitions REFERENCE - ISO:C90-6.5.3 Type Qualifiers

The value of this function parameter is never modified. It could be declared with the 'const' type qualifier.

'const' can be applied to any variable whose value needs to be set only once providing it can be initialized when it is defined.

For example:


/*PRQA S 2017,2211,3120,3408,3602 ++*/

extern int f1(int s)                  /* Message 3227 */
{
    int r1;                           /* Message 3204 */
    const int r2 = s;                 /*              */

    r1 = 2;

    return r1 + r2;
}


No MISRA C:2012 Rules applicable to message 3227


See also:

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