[previous] 0597 [next] Type of 'case' label expression is not consistent with type of controlling expression in 'switch' statement.
Switch statements

The type of this case label is not consistent with the type of the switch controlling expression. Ensure that the constant expression is of the same signedness as the controlling expression.

For example:


/*PRQA S 1278,2016,3120,3227,3408,3605 ++*/


extern void foo (int si, unsigned ui )
{
    switch ( si )
    {
    case 10U:                                   /* Message 0597 */
        break;
    case 20UL:                                  /* Message 0597 */
        break;
    default:
        break;
    }

    switch ( ui )
    {
    case 10:                                    /* Message 0597 */
        break;
    case 20L:                                   /* Message 0597 */
        break;
    default:
        break;
    }
}


No MISRA-C:2004 Rules applicable to message 0597


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