[previous] 1255 [next] Unsuffixed integer constant is not of type int.
Constants

This unsuffixed integer constant is not of type int. Would it be better to apply a suffix in order to make the type explicit ?

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

extern void foo(void)
{
    0x8000;                  /* Message 1255 and 1281 - unsigned int */
    32768;                   /* Message 1255          - signed long  */
}

See also:

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