[previous] 1256 [next] An integer constant suffixed with L is being converted to type signed or unsigned long long on assignment.
Arithmetic type - Assignment

This message is issued whenever an integer constant with L or UL suffix undergoes an assigning conversion to type long long or unsigned long long. Consider using LL or ULL suffix respectively.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1256 --*/
/**********************************
 * OPTIONS: -ex LONGLONG
 *********************************/

extern long               sla;
extern unsigned long      ula;

extern long long          sxa;
extern unsigned long long uxa;

void foo (long long a);

long long f1256 (void)
{
  sxa = 5L;                 /* 1256 */
  uxa = 5L;                 /* 1256 */

  sxa = 5UL;                /* 1256 */
  uxa = 5UL;                /* 1256 */

  sxa = 5LL;                /* OK, correct suffix specified */
  uxa = 5ULL;               /* OK, correct suffix specified */

  sxa = 5;                  /* OK, L suffix not specified */
  uxa = 5U;                 /* OK, L suffix not specified */

  foo (5L);                 /* 1256 */
    
  return 5L;                /* 1256 */
}

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