vonsy
传说中的水手
 
UID 281
精华
0
积分 42
帖子 42
阅读权限 1
注册 2005-8-8
状态 离线
|
兄弟们看看这句翻译的,不太明白.谢谢
Programming in the key of c# p167 goto语句:
类似于一个变量,标号也有它自己的作用范围。“标号的作用范围是对它进行声明的那个语句块,内嵌在该语句块内的其他语句块也包括在内。(摘自<C# Language Specification>文档第8.4小节>).C#不允许你跳转到另一个语句块里去,也就是说,你不能从if 或while或try语句内跳转到它们的外部去;你可以跳出一个语句块,但不能跳入一个语句块.
8.4 Labeled statements
A labeled-statement permits a statement to be prefixed by a label. Labeled statements are permitted
blocks, but are not permitted as embedded statements.
labeled-statement:
identifier : statement
A labeled statement declares a label with the name given by the identifier. The scope of a label is the
block in which the label is declared, including any nested blocks. It is an error for two labels with the
same name to have overlapping scopes.
A label can be referenced from goto statements (section 8.9.3) within the scope of the label. This
means that goto statements can transfer control inside blocks and out of blocks, but never into blocks.
Labels have their own declaration space and do not interfere with other identifiers. The example
int F(int x) {
if (x >= 0) goto x;
x = -x;
x: return x;
}
is valid and uses the name x as both a parameter and a label.
Execution of a labeled statement corresponds exactly to execution of the statement following the label.
In addition to the reachability provided by normal flow of control, a labeled statement is reachable if the
label is referenced by a reachable goto statement.
总结:能出不能进.
翻译的是不是有点问题呢??
|
|