![]() |
![]() |
3342 | ![]() |
||||
![]() | |||||||
| Control flow | |||||||
The controlling expression of a for loop (the second expression) is usually a relational or equality operation - for example, testing the value of a loop control variable. Message 3342 is generated when this expression contains any operations involving floating point operands. For example:
/*PRQA S 2017,3121,3132,3227,3408,3447 ++*/
extern float ftbuf[100];
extern void foo(float ftx, float fty)
{
float ft;
int i;
for (i = 0; ftbuf[i] > 0.0F; ++i) /* Message 3342 */
{
/* ... */
}
for (ft = 0.0F; ft < ftx; ft = ft + fty) /* Message 3342 and 3340 */
{
/* ... */
}
}
MISRA C:2012 Rules applicable to message 3342:
| Rule-14.1 (Required) | A loop counter shall not have essentially floating type |
![]() | ||
| 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 |