Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It won't compile because of '<code>GOTO block</code>' instead of '<code>goto block;</code>' and even if it was right it won't compile because C# specifications states (§8.9.3):</p> <blockquote> <p>The target of a <code>goto</code> <em>identifier</em> statement is the labeled statement with the given label. If a label with the given name does not exist in the current function member, or if the goto statement is not within the scope of the label, a compile-time error occurs. This rule permits the use of a goto statement to transfer control out of a nested scope, but not <em>into</em> a nested scope.</p> </blockquote> <p>Also I found couple specs interesting for me too:</p> <blockquote> <p>A goto statement cannot exit a <code>finally</code> block (§8.10). When a goto statement occurs within a <code>finally</code> block, the target of the goto statement must be within the same <code>finally</code> block, or otherwise a compile-time error occurs.</p> </blockquote> <p>And:</p> <blockquote> <p>A goto statement is executed as follows:</p> <ul> <li>If the goto statement exits one or more try blocks with associated finally blocks, >control is initially transferred to the finally block of the innermost try statement. When >and if control reaches the end point of a finally block, control is transferred to the >finally block of the next enclosing try statement. This process is repeated until the >finally blocks of all intervening try statements have been executed.</li> <li>Control is transferred to the target of the goto statement.</li> </ul> </blockquote> <p>the latter means that if you have</p> <pre><code>try { ... goto Label1; } finally { CloseAll(); } Label1: MethodB(); </code></pre> <p>it will call <code>CloseAll()</code> before actually transferring control to the <code>Label1</code> and executing <code>MethodB()</code>.</p> <p>Makes perfect sense, but I never thought about it...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload