Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Examples in 6.5.3 do not match definition of a loop-counter
#4
The official response seems reasonable to me - it has been given to us by the team that wrote the rule and they are simply clarifying the intent of the rule.

Think about it from the point of view of trying to check the code (with a tool). A tool will have to look for patterns within the code to try and identifiy when a loop is non-compliant. The C++ Standard does not define "loop counters". It may be "obvious" to a programmer what a loop counter is, but a formal specification is needed if tools are going to have a consistent interpretation of what is (or is not) a loop counter. The introductory text before 6-5-1 provides such a specification. The examples in 6-5-3 do not meet the criteria given and therefore do not have loop counters, even if the second example does have something "like a loop counter".

You say that "... only the programmer wanted some trickier modifiation and put it somewhere else". That is a good point and it highlights why the rules exist - they restrict the complexity that is acceptable for a loop without the use of a deviation.
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)