From Jason Turner

[stmt.for]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1887j4s8/{from.md → to.md} +6 -23
tmp/tmp1887j4s8/{from.md → to.md} RENAMED
@@ -16,37 +16,20 @@ is equivalent to
16
  expression ';'
17
  '}'
18
  '}'
19
  ```
20
 
21
- except that names declared in the *init-statement* are in the same
22
- declarative region as those declared in the *condition*, and except that
23
- a `continue` in *statement* (not enclosed in another iteration
24
- statement) will execute *expression* before re-evaluating *condition*.
25
 
26
  [*Note 1*: Thus the first statement specifies initialization for the
27
- loop; the condition [[stmt.select]] specifies a test, sequenced before
28
- each iteration, such that the loop is exited when the condition becomes
29
  `false`; the expression often specifies incrementing that is sequenced
30
  after each iteration. — *end note*]
31
 
32
  Either or both of the *condition* and the *expression* can be omitted. A
33
  missing *condition* makes the implied `while` clause equivalent to
34
  `while(true)`.
35
 
36
- If the *init-statement* is a declaration, the scope of the name(s)
37
- declared extends to the end of the `for` statement.
38
-
39
- [*Example 1*:
40
-
41
- ``` cpp
42
- int i = 42;
43
- int a[10];
44
-
45
- for (int i = 0; i < 10; i++)
46
- a[i] = i;
47
-
48
- int j = i; // j = 42
49
- ```
50
-
51
- — *end example*]
52
-
 
16
  expression ';'
17
  '}'
18
  '}'
19
  ```
20
 
21
+ except that the *init-statement* is in the same scope as the
22
+ *condition*, and except that a `continue` in *statement* (not enclosed
23
+ in another iteration statement) will execute *expression* before
24
+ re-evaluating *condition*.
25
 
26
  [*Note 1*: Thus the first statement specifies initialization for the
27
+ loop; the condition [[stmt.pre]] specifies a test, sequenced before each
28
+ iteration, such that the loop is exited when the condition becomes
29
  `false`; the expression often specifies incrementing that is sequenced
30
  after each iteration. — *end note*]
31
 
32
  Either or both of the *condition* and the *expression* can be omitted. A
33
  missing *condition* makes the implied `while` clause equivalent to
34
  `while(true)`.
35