13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12 Variables12.3.3.6 Switch statementsIn a switch statement stmt with controlling expression expr:• The definite assignment state of v at the beginning of expr is the same as the state of v at thebeginning of stmt.• The definite assignment state of v on the control flow transfer to a reachable switch block statementlist is the same as the definite assignment state of v at the end of expr.12.3.3.7 While statementsFor a while statement stmt of the form:while (expr) while-body• v has the same definite assignment state at the beginning of expr as at the beginning of stmt.• If v is definitely assigned at the end of expr, then it is definitely assigned on the control flow transferto while-body and to the end point of stmt.• If v has the state “definitely assigned after true expression” at the end of expr, then it is definitelyassigned on the control flow transfer to while-body, but not definitely assigned at the end-point ofstmt.• If v has the state “definitely assigned after false expression” at the end of expr, then it is definitelyassigned on the control flow transfer to the end point of stmt.12.3.3.8 Do statementsFor a do statement stmt of the form:do do-body while (expr);• v has the same definite assignment state on the control flow transfer from the beginning of stmt todo-body as at the beginning of stmt.• v has the same definite assignment state at the beginning of expr as at the end point of do-body.• If v is definitely assigned at the end of expr, then it is definitely assigned on the control flow transferto the end point of stmt.• If v has the state “definitely assigned after false expression” at the end of expr, then it is definitelyassigned on the control flow transfer to the end point of stmt.12.3.3.9 For statementsDefinite assignment checking for a for statement of the form:for (for-initializer; for-condition; for-iterator) embedded-statementis done as if the statement were written:{for-initializer;while (for-condition) {embedded-statement;for-iterator;}}If the for-condition is omitted from the for statement, then evaluation of definite assignment proceeds as iffor-condition were replaced with true in the above expansion.105

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!