You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Assigned to @gafter to confirm. The fact that it's currently the same for || as for && (both use "definitely assigned after true expression") rings alarm bells with me though.
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
However, i believe that is incorrect, the correct one should be
Because if the former is correct, then v can be definitely-assigned when it shouldn't be, consider the following situation:
From the reason above, i believe that the former is incorrect and the latter is the correct one
The text was updated successfully, but these errors were encountered: