请不要转载本文;请不要以任何形式重新出版,发布本文;请在下载本文 24 小时内将其删除;禁止将本文用于商业目的。
3.3 Declarative regions and scopes [basic.scope]
3.3.2 Local scope [basic.scope.local]
3.3.2 局部作用域 【基本.作用域.局部】
A name declared in a block (6.3) is local to that block. Its potential scope begins at its point of declaration (3.3.1) and ends at the end of its declarative region.
块(6.3)中声明的名字是局部于这个块的。它的潜在作用域从其声明点(3.3.1)开始,到其声明区域的结尾结束。
The potential scope of a function parameter name in a function definition (8.4) begins at its point of declaration. If the function has a function try-block the potential scope of a parameter ends at the end of the last associated handler, else it ends at the end of the outermost block of the function definition. A parameter name shall not be redeclared in the outermost block of the function definition nor in the outermost block of any handler associated with a function try-block.
函数定义(8.4)中函数参数名的潜在作用域从其声明点开始。如果该函数具有函数 try-块,则参数的潜在作用域到其最后一个关联处理器的结尾结束,否则就到该函数最外层块的结尾结束。参数名在函数定义的最外层块中,以及任何该函数的函数 try-块关联的任何处理器的最外层块中,都不能重新声明。
The name in a catch exception-declaration is local to the handler and shall not be redeclared in the outer most block of the handler.
在 catch 异常声明中的名字局部于该处理器,并且不能在该处理器的最外层块中重新声明。
Names declared in the for-init-statement, and in the condition of if, while, for, and switch statements are local to the if, while, for, or switch statement (including the controlled statement), and shall not be redeclared in a subsequent condition of that statement nor in the outermost block (or, for the if statement, any of the outermost blocks) of the controlled statement; see 6.4.
在 for-初始化-语句中声明的名字,以及在 if,while,for,和 switch 语句的条件中声明的名字,局部于 if,while,for,或 switch 语句(包括被控语句),并且不能在其语句的条件子序列,或其被控语句的最外层块中重新声明;参见 6.4。