12.3.3.15 Try-catch-finally statements

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

12.3.3.15 Try-catch-finally statements

Definite assignment analysis for a try-catch-finally statement of the form:

try try-block

catch(.) catch-block-1

.

catch(.) catch-block-n

finally finally-block

is done as if the statement were a try-finally statement enclosing a

try-catch statement:

try {

try try-block

catch(.) catch-block-1

.

catch(.) catch-block-n

}

finally finally-block

[Example: The following example demonstrates how the different blocks of a

try statement (§15.10) affect

definite assignment.

class A

{

static void F() {

int i, j;

try {

goto LABEL;

// neither i nor j definitely assigned

i = 1;

// i definitely assigned

}

catch {

// neither i nor j definitely assigned

i = 3;

// i definitely assigned

}

C# LANGUAGE SPECIFICATION

108

finally {

// neither i nor j definitely assigned

j = 5;

// j definitely assigned

}

// i and j definitely assigned

LABEL:;

// j definitely assigned

}

}

end example]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有  導航