[previous] 1276 [next] An integer constant is being converted to floating type on assignment.
Arithmetic type - Implicit conversions

This message is issued whenever an integer constant undergoes an assigning conversion to a floating type. Perhaps the constant should be rewritten as a floating constant ?

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1276 --*/

extern float       fta;
extern double      dba;
extern long double lda;

void foo (float a);

float f1276 (void)
{
  fta = 5;                  /* 1276 */
  dba = 5;                  /* 1276 */
  lda = 5;                  /* 1276 */
  
  foo (5);                  /* 1276 */

  return 5;                 /* 1276 */
}


No MISRA C:2012 Rules applicable to message 1276


See also:

QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents