![]() |
![]() |
4123 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Complex expressions | |||||||
The value of an expression of type float is being implicitly converted to type double. Be aware that the expression itself is not evaluated in type double. Message 4123 is generated when the value resulting from some specific operators is of type float and is implicitly converted to type double. However the message will only be generated if the size of type double is greater than the size of type float. The only operators which may trigger this message are * / + and -. The danger associated with this type of operation is that the programmer may assume, incorrectly, that the arithmetic operation is performed in type double rather than type float.
/*PRQA S 2017,3198,3199,3203,3408,3447 ++*/
extern float fta;
extern float ftb;
extern void foo(void)
{
double dba;
dba = fta * ftb; /* Message 4123 */
dba = fta / ftb; /* Message 4123 */
dba = fta + ftb; /* Message 4123 */
dba = fta - ftb; /* Message 4123 */
dba = (double)(fta * ftb); /* Message 4126 */
dba = (double)(fta / ftb); /* Message 4126 */
dba = (double)(fta + ftb); /* Message 4126 */
dba = (double)(fta - ftb); /* Message 4126 */
}
No MISRA C:2012 Rules applicable to message 4123
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 |