![]() |
![]() |
3340 | ![]() |
||||
![]() | |||||||
| Control flow | |||||||
The variable identified as the the loop control variable in this 'for loop' is of floating type. QAC identifies a loop control variable by examining the 3 'for-loop' expressions. Usually it is a variable in the 2nd expression which is the operand of a relational operator. For example:
/*PRQA S 2017 ++*/
/*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 3340:
| 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 |