disable broken tests on net_4_0
[mcs.git] / docs / ecma334 / 15.4.xml
blobedb6e9d287e008c0627ea2d24db6ef64b8df4ed7
1 <?xml version="1.0"?>
2 <clause number="15.4" title="Labeled statements">
3   <paragraph>A <non_terminal where="15.4">labeled-statement</non_terminal> permits a statement to be prefixed by a label. Labeled statements are permitted in blocks, but are not permitted as embedded statements. <grammar_production><name><non_terminal where="15.4">labeled-statement</non_terminal></name> : <rhs><non_terminal where="9.4.2">identifier</non_terminal><terminal>:</terminal><non_terminal where="15">statement</non_terminal></rhs></grammar_production></paragraph>
4   <paragraph>A labeled statement declares a label with the name given by the identifier. The scope of a label is the whole block in which the label is declared, including any nested blocks. It is a compile-time error for two labels with the same name to have overlapping scopes. </paragraph>
5   <paragraph>A label can be referenced from goto statements (<hyperlink>15.9.3</hyperlink>) within the scope of the label. <note>[Note: This means that goto statements can transfer control within blocks and out of blocks, but never into blocks. end note]</note> </paragraph>
6   <paragraph>Labels have their own declaration space and do not interfere with other identifiers. <example>[Example: The example <code_example><![CDATA[
7 int F(int x) {  
8    if (x >= 0) goto x;  
9    x = -x;  
10    x: return x;  
11 }  
12 ]]></code_example>is valid and uses the name x as both a parameter and a label. end example]</example> </paragraph>
13   <paragraph>Execution of a labeled statement corresponds exactly to execution of the statement following the label. </paragraph>
14   <paragraph>In addition to the reachability provided by normal flow of control, a labeled statement is reachable if the label is referenced by a reachable goto statement. (Exception: If a goto statement is inside a try that includes a finally block, and the labeled statement is outside the try, and the end point of the finally block is unreachable, then the labeled statement is not reachable from that goto statement.) </paragraph>
15 </clause>