-
Notifications
You must be signed in to change notification settings - Fork 92
Description
I downloaded the C# language specification 7th edition via https://ecma-international.org/publications-and-standards/standards/ecma-334/. In chapter 9.4.4.27 about definite-assignment state of || expressions, it was written
The definite-assignment state of v before expr_second is definitely assigned if and only if the state of
v after expr_first is either definitely assigned or “definitely assigned after true expression”.
Otherwise, it is not definitely assigned.
However, i believe that is incorrect, the correct one should be
The definite-assignment state of v before expr_second is definitely assigned if and only if the state of
v after expr_first is either definitely assigned or “definitely assigned after false expression”.
Otherwise, it is not definitely assigned.
Because if the former is correct, then v can be definitely-assigned when it shouldn't be, consider the following situation:
- The definite-assignment state of v after expr_first is definitely assigned after true expression
- expr_first is false
- expr_second is evaluated and the definite-assignment state of v before expr_second is definitely-assigned, however because number 1 and 2, then v is not actually assigned.
From the reason above, i believe that the former is incorrect and the latter is the correct one