Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 12 Variablesprevious at this levelnext at this level 12.3 Definite assignmentprevious at this levelnext at this level 12.3.3 Precise rules for determining definite assignmentprevious at this levelnext at this level 12.3.3.23 && expressions Paragraph 11 For an expression expr of the form expr-first && expr-second: [Example: In the example
class A  
{  
   static void F(int x, int y) {  
      int i;  
      if (x >= 0 && (i = y) >= 0) {  
         // i definitely assigned  
      }  
      else {  
         // i not definitely assigned  
      }  
      // i not definitely assigned  
   }  
}  
the variable i is considered definitely assigned in one of the embedded statements of an if statement but not in the other. In the if statement in method F, the variable i is definitely assigned in the first embedded statement because execution of the expression (i = y) always precedes execution of this embedded statement. In contrast, the variable i is not definitely assigned in the second embedded statement, since x >= 0 might have tested false, resulting in the variable i's being unassigned. end example]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS