[previous] 3309 [next] The value of the controlling expression in this 'switch' statement is constant.
Switch statements

The controlling expression in this 'switch' statement is a constant expression and so there will be only one 'case' or 'default' label that is reachable. Is this intended ?

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 3309,2880,2881 --*/

#define N 3

extern void foo(void)
{
    switch (N)                          /* Message 3309 */
    {
    case 1:                             /* Message 2880 */
        break;
    case 3:
        break;
    default:                            /* Message 2881 */
        break;
    }
}

See also:

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