[previous] 3209 [next] '%s()' returns a value which is always ignored.
Functions REFERENCE - ISO:C90-6.6.6.4 The return Statement

This function has been declared with a "non-void" return type but the value returned is always ignored.

If a function returns a value, it is usually intended that the value should be used in some way. If it is really intended that a return value should be ignored, it is conventional to cast it to "void".

For example:


/*PRQA S 2017,3198,3408,3447 ++ */

extern int f1(void);                            /* Message 3209 */
extern int f2(void);                            /* Message 3208 */
extern int f3(void);                            /* No message   */
extern int f4(void);                            /* No message   */

extern int foo(void)
{
    int r;

    f1();                                       /* Message 3200 */

    f2();                                       /* Message 3200 */
    r = f2();

    (void)f3();                                 /* No message   */

    (void)f4();                                 /* No message   */
    r = f2();

    return r;
}


No MISRA C:2012 Rules applicable to message 3209


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