tmp/tmpv2aj1bof/{from.md → to.md}
RENAMED
|
@@ -1,17 +1,19 @@
|
|
| 1 |
### The `switch` statement <a id="stmt.switch">[[stmt.switch]]</a>
|
| 2 |
|
| 3 |
The `switch` statement causes control to be transferred to one of
|
| 4 |
several statements depending on the value of a condition.
|
| 5 |
|
| 6 |
-
The
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
``` bnf
|
| 15 |
case constant-expression ':'
|
| 16 |
```
|
| 17 |
|
|
@@ -62,8 +64,8 @@ is equivalent to
|
|
| 62 |
init-statement
|
| 63 |
switch '(' condition ')' statement
|
| 64 |
'}'
|
| 65 |
```
|
| 66 |
|
| 67 |
-
except that
|
| 68 |
-
|
| 69 |
|
|
|
|
| 1 |
### The `switch` statement <a id="stmt.switch">[[stmt.switch]]</a>
|
| 2 |
|
| 3 |
The `switch` statement causes control to be transferred to one of
|
| 4 |
several statements depending on the value of a condition.
|
| 5 |
|
| 6 |
+
The value of a *condition* that is an initialized declaration is the
|
| 7 |
+
value of the declared variable, or the value of the *expression*
|
| 8 |
+
otherwise. The value of the condition shall be of integral type,
|
| 9 |
+
enumeration type, or class type. If of class type, the condition is
|
| 10 |
+
contextually implicitly converted [[conv]] to an integral or enumeration
|
| 11 |
+
type. If the (possibly converted) type is subject to integral promotions
|
| 12 |
+
[[conv.prom]], the condition is converted to the promoted type. Any
|
| 13 |
+
statement within the `switch` statement can be labeled with one or more
|
| 14 |
+
case labels as follows:
|
| 15 |
|
| 16 |
``` bnf
|
| 17 |
case constant-expression ':'
|
| 18 |
```
|
| 19 |
|
|
|
|
| 64 |
init-statement
|
| 65 |
switch '(' condition ')' statement
|
| 66 |
'}'
|
| 67 |
```
|
| 68 |
|
| 69 |
+
except that the *init-statement* is in the same scope as the
|
| 70 |
+
*condition*.
|
| 71 |
|