[previous] 1252 [next] Suffixed integer constant implicitly converted to different integer type.
Arithmetic type - Balancing

In the course of a type balancing operation, a suffixed integer constant is being implicitly converted to another type. Is the type conversion really intended or does this indicate that the suffix is inappropriate ?

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 1278,2017,3112,3120,3408,3447 ++*/
/******************************
 * OPTIONS: -s int=16
 ******************************/

extern long          sla;
extern unsigned long ula;

void foo( void )
{
    sla + 5L;                   /*              */
    sla + 5U;                   /* Message 1252 */
    sla + 5;                    /* Message 1253 */

    ula + 5UL;                  /*              */
    ula + 5U;                   /* Message 1252 */
    ula + 5L;                   /* Message 1252 */
    ula + 5;                    /* Message 1253 */
}

See also:

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