From Jason Turner

[stmt.iter.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjjboze40/{from.md → to.md} +26 -14
tmp/tmpjjboze40/{from.md → to.md} RENAMED
@@ -8,24 +8,10 @@ iteration-statement:
8
  do statement while '(' expression ')' ';'
9
  for '(' init-statement conditionₒₚₜ ';' expressionₒₚₜ ')' statement
10
  for '(' init-statementₒₚₜ for-range-declaration ':' for-range-initializer ')' statement
11
  ```
12
 
13
- ``` bnf
14
- for-range-declaration:
15
- attribute-specifier-seqₒₚₜ decl-specifier-seq declarator
16
- attribute-specifier-seqₒₚₜ decl-specifier-seq ref-qualifierₒₚₜ '[' identifier-list ']'
17
- ```
18
-
19
- ``` bnf
20
- for-range-initializer:
21
- expr-or-braced-init-list
22
- ```
23
-
24
- See  [[dcl.meaning]] for the optional *attribute-specifier-seq* in a
25
- *for-range-declaration*.
26
-
27
  [*Note 1*: An *init-statement* ends with a semicolon. — *end note*]
28
 
29
  The substatement in an *iteration-statement* implicitly defines a block
30
  scope [[basic.scope]] which is entered and exited each time through the
31
  loop. If the substatement in an *iteration-statement* is a single
@@ -49,5 +35,31 @@ while (--x >= 0) {
49
 
50
  Thus after the `while` statement, `i` is no longer in scope.
51
 
52
  — *end example*]
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  do statement while '(' expression ')' ';'
9
  for '(' init-statement conditionₒₚₜ ';' expressionₒₚₜ ')' statement
10
  for '(' init-statementₒₚₜ for-range-declaration ':' for-range-initializer ')' statement
11
  ```
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  [*Note 1*: An *init-statement* ends with a semicolon. — *end note*]
14
 
15
  The substatement in an *iteration-statement* implicitly defines a block
16
  scope [[basic.scope]] which is entered and exited each time through the
17
  loop. If the substatement in an *iteration-statement* is a single
 
35
 
36
  Thus after the `while` statement, `i` is no longer in scope.
37
 
38
  — *end example*]
39
 
40
+ A *trivially empty iteration statement* is an iteration statement
41
+ matching one of the following forms:
42
+
43
+ - `while (` *expression* `) ;`
44
+ - `while (` *expression* `) { }`
45
+ - `do ; while (` *expression* `) ;`
46
+ - `do { } while (` *expression* `) ;`
47
+ - `for (` *init-statement* *expression*ₒₚₜ `; ) ;`
48
+ - `for (` *init-statement* *expression*ₒₚₜ `; ) { }`
49
+
50
+ The *controlling expression* of a trivially empty iteration statement is
51
+ the *expression* of a `while`, `do`, or `for` statement (or `true`, if
52
+ the `for` statement has no *expression*). A *trivial infinite loop* is a
53
+ trivially empty iteration statement for which the converted controlling
54
+ expression is a constant expression, when interpreted as a
55
+ *constant-expression* [[expr.const]], and evaluates to `true`. The
56
+ *statement* of a trivial infinite loop is replaced with a call to the
57
+ function `std::this_thread::yield` [[thread.thread.this]]; it is
58
+ *implementation-defined* whether this replacement occurs on freestanding
59
+ implementations.
60
+
61
+ [*Note 2*: In a freestanding environment, concurrent forward progress
62
+ is not guaranteed; such systems therefore require explicit cooperation.
63
+ A call to yield can add implicit cooperation where none is otherwise
64
+ intended. — *end note*]
65
+