X hits on this document

982 views

0 shares

0 downloads

0 comments

106 / 396

Chapter ‎18   Unsafe code

and unchecked expressions (§‎7.5.12), array and delegate creation expressions (§‎7.5.10).

Each of these expressions has one or more sub-expressions that are unconditionally evaluated in a fixed order. For example, the binary % operator evaluates the left hand side of the operator, then the right hand side. An indexing operation evaluates the indexed expression, and then evaluates each of the index expressions, in order from left to right. For an expression expr, which has sub-expressions expr1, expr2, ..., exprn, evaluated in that order:

The definite assignment state of v at the beginning of expr1 is the same as the definite assignment state at the beginning of expr.

The definite assignment state of v at the beginning of expri (i greater than one) is the same as the definite assignment state at the end of expri-1.

The definite assignment state of v at the end of expr is the same as the definite assignment state at the end of exprn.

5.3.3.21 Invocation expressions and object creation expressions

For an invocation expression expr of the form:

primary-expression ( arg1 , arg2 , … , argn )

or an object creation expression of the form:

new type ( arg1 , arg2 , … , argn )

For an invocation expression, the definite assignment state of v before primary-expression is the same as the state of v before expr.

For an invocation expression, the definite assignment state of v before arg1 is the same as the state of v after primary-expression.

For an object creation expression, the definite assignment state of v before arg1 is the same as the state of v before expr.

For each argument argi, the definite assignment state of v after argi is determined by the normal expression rules, ignoring any ref or out modifiers.

For each argument argi for any i greater than one, the definite assignment state of v before argi is the same as the state of v after argi-1.

If the variable v is passed as an out argument (i.e., an argument of the form “out v”) in any of the arguments, then the state of v after expr is definitely assigned. Otherwise; the state of v after expr is the same as the state of v after argn.

5.3.3.22 Simple assignment expressions

For an expression expr of the form w = expr-rhs:

The definite assignment state of v before expr-rhs is the same as the definite assignment state of v before expr.

If w is the same variable as v, then the definite assignment state of v after expr is definitely assigned. Otherwise, the definite assignment state of v after expr is the same as the definite assignment state of v after expr-rhs.

5.3.3.23 && expressions

For an expression expr of the form expr-first && expr-second:

Copyright Microsoft Corporation 1999-2003. All Rights Reserved.93

Document info
Document views982
Page views982
Page last viewedFri Dec 09 02:07:37 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments