[previous] 1266 [next] A floating constant is being converted to integral type on assignment.
Arithmetic type - Assignment

This message is issued whenever a floating constant undergoes an assigning conversion to integral type.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1266, 1269 --*/

extern int sia;

void foo (int a);

int f1266 (void)
{
  sia   = 5.0F;             /* 1266 */
  sia   = (int)5.0F;        /* 1269 */

  sia   = 5.0;              /* 1266 */
  sia   = (int)5.0;         /* 1269 */

  sia   = 5.0L;             /* 1266 */
  sia   = (int)5.0L;        /* 1269 */
  
  foo (5.0);                /* 1266 */

  return 5.0;               /* 1266 */
}

See also:

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