|
1 | 1 | --- |
2 | | -title: "Summary of Statements" |
3 | | -ms.date: "11/04/2016" |
| 2 | +title: "Summary of C statements" |
| 3 | +description: "A summary of the statement grammar in the Microsoft C implementation." |
| 4 | +ms.date: 08/24/2020 |
4 | 5 | ms.assetid: ce45d2fe-ec0e-459f-afb1-80ab6a7f0239 |
5 | 6 | --- |
6 | | -# Summary of Statements |
7 | | - |
8 | | -*statement*:<br/> |
9 | | - *labeled-statement*<br/> |
10 | | - *compound-statement*<br/> |
11 | | - *expression-statement*<br/> |
12 | | - *selection-statement*<br/> |
13 | | - *iteration-statement*<br/> |
14 | | - *jump-statement*<br/> |
15 | | - *try-except-statement* /\* Microsoft-specific \*/<br/> |
16 | | - *try-finally-statement* /\* Microsoft-specific \*/ |
17 | | - |
18 | | -*jump-statement*:<br/> |
19 | | - **`goto`** *identifier* **;**<br/> |
20 | | - **continue ;**<br/> |
21 | | - **break ;**<br/> |
22 | | - **`return`** *expression*<sub>opt</sub> **;** |
23 | | - |
24 | | -*compound-statement*:<br/> |
25 | | - **{** *declaration-list*<sub>opt</sub> *statement-list*<sub>opt</sub> **}** |
26 | | - |
27 | | -*declaration-list*:<br/> |
28 | | - *declaration*<br/> |
29 | | - *declaration-list* *declaration* |
30 | | - |
31 | | -*statement-list*:<br/> |
32 | | - *statement*<br/> |
33 | | - *statement-list* *statement* |
34 | | - |
35 | | -*expression-statement*:<br/> |
36 | | - *expression*<sub>opt</sub> **;** |
37 | | - |
38 | | -*iteration-statement*:<br/> |
39 | | - **while (** *expression* **)** *statement*<br/> |
40 | | - **`do`** *statement* **while (** *expression* **) ;**<br/> |
41 | | - **for (** *expression*<sub>opt</sub> **;** *expression*<sub>opt</sub> **;** *expression*<sub>opt</sub> **)** *statement* |
42 | | - |
43 | | -*selection-statement*:<br/> |
44 | | - **if (** *expression* **)** *statement*<br/> |
45 | | - **if (** *expression* **)** *statement* **`else`** *statement*<br/> |
46 | | - **switch (** *expression* **)** *statement* |
47 | | - |
48 | | -*labeled-statement*:<br/> |
49 | | - *identifier* **:** *statement*<br/> |
50 | | - **`case`** *constant-expression* **:** *statement*<br/> |
51 | | - **default :** *statement* |
52 | | - |
53 | | -*try-except-statement*: /\* Microsoft-specific \*/<br/> |
54 | | - **__try** *compound-statement* **__except (** *expression* **)** *compound-statement* |
55 | | - |
56 | | -*try-finally-statement*: /\* Microsoft-specific \*/<br/> |
57 | | - **__try** *compound-statement* **`__finally`** *compound-statement* |
| 7 | +# Summary of C statements |
| 8 | + |
| 9 | +*`statement`*:<br/> |
| 10 | + *`labeled-statement`*<br/> |
| 11 | + *`compound-statement`*<br/> |
| 12 | + *`expression-statement`*<br/> |
| 13 | + *`selection-statement`*<br/> |
| 14 | + *`iteration-statement`*<br/> |
| 15 | + *`jump-statement`*<br/> |
| 16 | + *`try-except-statement`* /\* Microsoft-specific \*/<br/> |
| 17 | + *`try-finally-statement`* /\* Microsoft-specific \*/ |
| 18 | + |
| 19 | +*`jump-statement`*:<br/> |
| 20 | + **`goto`** *`identifier`* **`;`**<br/> |
| 21 | + **`continue ;`**<br/> |
| 22 | + **`break ;`**<br/> |
| 23 | + **`return`** *`expression`*<sub>opt</sub> **`;`**<br/> |
| 24 | + **`__leave ;`** /\* Microsoft-specific<sup>1</sup> \*/ |
| 25 | + |
| 26 | +*`compound-statement`*:<br/> |
| 27 | + **`{`** *`declaration-list`*<sub>opt</sub> *`statement-list`*<sub>opt</sub> **`}`** |
| 28 | + |
| 29 | +*`declaration-list`*:<br/> |
| 30 | + *`declaration`*<br/> |
| 31 | + *`declaration-list`* *`declaration`* |
| 32 | + |
| 33 | +*`statement-list`*:<br/> |
| 34 | + *`statement`*<br/> |
| 35 | + *`statement-list`* *`statement`* |
| 36 | + |
| 37 | +*`expression-statement`*:<br/> |
| 38 | + *`expression`*<sub>opt</sub> **`;`** |
| 39 | + |
| 40 | +*`iteration-statement`*:<br/> |
| 41 | + **`while (`** *`expression`* **`)`** *`statement`*<br/> |
| 42 | + **`do`** *`statement`* **`while (`** *`expression`* **`) ;`**<br/> |
| 43 | + **`for (`** *`expression`*<sub>opt</sub> **`;`** *`expression`*<sub>opt</sub> **`;`** *`expression`*<sub>opt</sub> **`)`** *`statement`* |
| 44 | + |
| 45 | +*`selection-statement`*:<br/> |
| 46 | + **`if (`** *`expression`* **`)`** *`statement`*<br/> |
| 47 | + **`if (`** *`expression`* **`)`** *`statement`* **`else`** *`statement`*<br/> |
| 48 | + **`switch (`** *`expression`* **`)`** *`statement`* |
| 49 | + |
| 50 | +*`labeled-statement`*:<br/> |
| 51 | + *`identifier`* **`:`** *`statement`*<br/> |
| 52 | + **`case`** *`constant-expression`* **`:`** *`statement`*<br/> |
| 53 | + **`default :`** *`statement`* |
| 54 | + |
| 55 | +*`try-except-statement`*: /\* Microsoft-specific \*/<br/> |
| 56 | + **`__try`** *`compound-statement`* **`__except (`** *`expression`* **`)`** *`compound-statement`* |
| 57 | + |
| 58 | +*`try-finally-statement`*: /\* Microsoft-specific \*/<br/> |
| 59 | + **`__try`** *`compound-statement`* **`__finally`** *`compound-statement`* |
| 60 | + |
| 61 | +1 The **`__leave`** keyword is only valid within the **`__try`** block of a *`try-except-statement`* or a *`try-finally-statement`*. |
58 | 62 |
|
59 | 63 | ## See also |
60 | 64 |
|
61 | | -[Phrase Structure Grammar](../c-language/phrase-structure-grammar.md) |
| 65 | +[Phrase structure grammar](../c-language/phrase-structure-grammar.md) |
0 commit comments