![]() |
![]() |
1265 | ![]() |
||||
![]() | |||||||
| 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 */
}
MISRA C:2012 Rules applicable to message 1265:
| Rule-10.3 (Required) | The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category. |
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 |