[previous] 3404 [next] Statement contains a redundant * operator at top level. *p++ means *(p++) not (*p)++.
Redundancy

The dereference operation ( * ) in this expression is redundant because the value obtained is never used. Perhaps the intention was that the increment or decrement operation was to be applied after rather than before the dereference ? If so, the expression should be rewritten with parentheses as shown in the code example below.


/*PRQA S 489,506,2017,3199,3210,3205,3401,3403,3408,3440,3447,3673 ++*/

void foo(int *p)
{
    *p++;                         /* Message 3404 */

    (*p)++;                       /* OK */
}


No MISRA C:2012 Rules applicable to message 3404


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