[previous] 1882 [next] The 2nd and 3rd operands of this conditional operator are expressions of different 'essential type' categories (%1s and %2s).
Arithmetic type - Balancing

This message is issued when the 2nd and 3rd operands of a conditional operator are of different essential type categories.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1882, 1804, 1824 --*/

_Bool             boa;
char              pca;
enum E {ONE, TWO} ena;
enum F {UNO, DUE} enb;
int               sia;
unsigned          uia;
float             fta;

void foo (int b, ...);

void f1882 (_Bool a)
{
  int r = 0;

  foo (0, a ? boa : pca) ;  /* 1882 */
  foo (0, a ? boa : ena) ;  /* 1882 */
  foo (0, a ? boa : sia) ;  /* 1882 */
  foo (0, a ? boa : uia) ;  /* 1882 */
  foo (0, a ? boa : fta) ;  /* 1882 */

  foo (0, a ? pca : ena) ;  /* 1882 */
  foo (0, a ? pca : sia) ;  /* 1882 */
  foo (0, a ? pca : uia) ;  /* 1882 */
  foo (0, a ? pca : fta) ;  /* 1882 */

  foo (0, a ? ena : enb) ;  /* 1882 */
  foo (0, a ? ena : sia) ;  /* 1882 */
  foo (0, a ? ena : uia) ;  /* 1882 */
  foo (0, a ? ena : fta) ;  /* 1804 */

  foo (0, a ? sia : uia) ;  /* 1824 */
  foo (0, a ? sia : fta) ;  /* 1804 */

  foo (0, a ? uia : fta) ;  /* 1804 */
}

See also:

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