[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;
    }
}

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