Next: 6 Constants  Up: 5 Control Flow  Previous: High Integrity CPP Rule 5.11  Contents

High Integrity CPP Rule 5.12   Declare for loop control variables within the for statement instead of using an existing variable.
(QA C++  4230)

Justification

This is a best practice rule. The main advantage is that the scope of the loop control variable is naturally limited to the for loop statement, using this construct achieves this minimum scope.

See also

Rule 8.2.2, Rule 8.4.4


HICPP VERSION 2.4  http://www.codingstandard.com   Copyright: © 2007 THE PROGRAMMING RESEARCH GROUP