[previous] 1250 [next] Unsuffixed integer constant causes implicit conversion of other operand.
Arithmetic type - Balancing

An unsuffixed integer constant is one operand of a binary operator for which type balancing occurs. Message 1250 is generated to identify the fact that this unsuffixed constant causes the other (non-constant) operand to undergo an implicit type conversion and so its type is of some significance. Message 1255 is also generated because, the value of the constant is large and so,despite the absence of a suffix, it is not of type int (it may be of type unsigned int or one of the larger integer types).

Note that the type of an integer constant depends on its value and the implemented size of an int (e.g. whether it is a 16 bit or 32 bit quantity ) as well as the presence of suffixes. More ...

For example:


/*PRQA S 1277,1281,2017,3112,3120,3227,3408,3606 ++*/
/********************************
 * OPTIONS: -s int=16
 ********************************/

extern void foo( int sia, unsigned int uia )
{
    sia + 40000;         /* Messages 1255 and 1250 */
    sia + 0x8000;        /* Messages 1255 and 1250 + - 3760 Implicit conversion int to unsigned int  */
    sia + 0x80000000;    /* Messages 1255 and 1250 + - 3762 Implicit conversion int to unsigned long */

    uia + 40000;         /* Messages 1255 and 1250 + - 3772 Implicit conversion unsigned int to long */
    uia + 0x8000;        /* Messages 1255          */
    uia + 0x80000000;    /* Messages 1255 and 1250 */
}

See also:

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