![]() |
![]() |
4128 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Complex expressions | |||||||
The value of an expression of type double is being cast to type long double. Be aware that the expression itself is not evaluated in type long double. Message 4128 is generated when the value resulting from four specific operators is of type double and is explicitly cast 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 double. 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 double.
/*PRQA S 2017,3198,3199,3203,3408,3447 ++*/
/********************************
* OPTIONS: -s ldouble=128
*******************************/
extern double dba;
extern double dbb;
extern void foo(void)
{
long double lda;
lda = dba * dbb; /* Message 4125 */
lda = dba / dbb; /* Message 4125 */
lda = dba + dbb; /* Message 4125 */
lda = dba - dbb; /* Message 4125 */
lda = (long double)(dba * dbb); /* Message 4128 */
lda = (long double)(dba / dbb); /* Message 4128 */
lda = (long double)(dba + dbb); /* Message 4128 */
lda = (long double)(dba - dbb); /* Message 4128 */
}
No MISRA-C:2004 Rules applicable to message 4128
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |