### 3 基本概念 【基本】

#### 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.

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.

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-初始化-语句中声明的名字，以及在 ifwhilefor，和 switch 语句的条件中声明的名字，局部于 ifwhilefor，或 switch 语句（包括被控语句），并且不能在其语句的条件子序列，或其被控语句的最外层块中重新声明；参见 6.4。

PREV [basic.scope.pdecl] | NEXT [basic.scope.proto] 上一页 【基本.作用域.声明点】 | 下一页 【基本.作用域.原型】

0 0