Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

MISRA.FOR.COND

For loop condition does not depend on loop counter.

MISRA-C Rule 13.5 (required): The three expressions of a for statement shall be concerned only with loop control.

This rule is also covered by MISRA.FOR.INCR.CHANGE.

The three expressions of a for statement shall be used only for these purposes:

First expression Initialising the loop counter ('i' in the following example)
Second expression Shall include testing the loop counter ('i'), and optionally other loop control variables ('flag')
Third expression Increment or decrement of the loop counter ('i')

The following options are allowed:

(a) All three expressions shall be present;
(b) The second and third expressions shall be present with prior initialisation of the loop counter;
(c) All three expressions shall be empty for a deliberate infinite loop.