[previous] 1265 [next] An unsuffixed floating constant is being converted to a different floating type on assignment.
Arithmetic type - Assignment

This message is issued whenever an unsuffixed floating constant undergoes an assigning conversion to a different floating type. Consider adding a suffix to match the assigned-to type.

Remember, an unsuffixed floating constant is always of type double. A constant of type float is suffixed with "F", and a constant of type long double is suffixed with "L".

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1264, 1265 --*/

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

void foo (float a);

float f1264 (void)
{
  fta = 5.3F;
  fta = 5.3;                /* 1265 */
  fta = 5.3L;               /* 1264 */

  dba = 5.3F;               /* 1264 */
  dba = 5.3;
  dba = 5.3L;               /* 1264 */

  lda = 5.3F;               /* 1264 */
  lda = 5.3;                /* 1265 */
  lda = 5.3L;
  
  foo (5.3);                /* 1265 */
  
  return 5.3;               /* 1265 */
}

See also:

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