[previous] 0596 [next] Value of 'case' label expression is too large for type of controlling expression in 'switch' statement.
Switch statements

The value of this case label expression is too large to be able to match the controlling expression of the switch statement. The case label will be unreachable.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 596, 2880 --*/

extern int x;

void foo( signed char c )
{
    switch ( c )
    {
    case 100:
        --x;
        break;

    case 200:                   /* Messages 596 and 2880 */
        ++x;
        break;

    default:
        x = 0;
        break;
    }
}


No MISRA C:2012 Rules applicable to message 0596


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