[previous] 0571 [next] This switch case label of 'essential type' '%1s' is not consistent with a controlling expression which has an essential type of higher rank (%2s).
Switch statements

This message is issued whenever a switch controlling expression and a case constant expression have the same essential type category, but the controlling expression is of higher rank. Specifically, the message is only issued then the former if of rank long long, and the later of rank long.

Consider using an 'LL' (respectively 'ULL') suffix to match the rank of both expressions, or not using a suffix at all.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 0571 --*/

/********************************
 * OPTIONS: -ex LONGLONG
 *******************************/

void f0571 (long long a)
{
  switch (a)
  {
  case 0L:              /* Message 0571 */
  case (long) 1:        /* Message 0571 */
  case 2:               /* OK */
  case 3LL:             /* OK */
    break;
  default:
    break;
  }
}

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