![]() |
![]() |
4124 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Complex expressions | |||||||
The value of an expression of type float is being implicitly converted to type long double. Be aware that the expression itself is not evaluated in type long double. Message 4124 is generated when the value resulting from four specific operators is of type float and is implicitly converted to type long double. However the message will only be generated if the size of type long 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 long double rather than type float.
/*PRQA S 2017,3198,3199,3203,3408,3447 ++*/
extern float fta;
extern float ftb;
extern void foo(void)
{
long double lda;
lda = fta * ftb; /* Message 4124 */
lda = fta / ftb; /* Message 4124 */
lda = fta + ftb; /* Message 4124 */
lda = fta - ftb; /* Message 4124 */
lda = (long double)(fta * ftb); /* Message 4127 */
lda = (long double)(fta / ftb); /* Message 4127 */
lda = (long double)(fta + ftb); /* Message 4127 */
lda = (long double)(fta - ftb); /* Message 4127 */
}
No MISRA C:2012 Rules applicable to message 4124
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 |