プログラミング言語C/C++のラベル(label)名は、他の識別子名(関数名や変数名など)と独立した名前空間*1を持つ。
void f() { /* foo statement */; std: // OK /* bar statement */; }
C++03 6.1/p1より該当箇所を引用。
(snip) Labels have their own name space and do not interfere with other identifiers.
C99 6.2.3/p1より該当箇所を引用。
If more than one declaration of a particular identifier is visible at any point in a translation unit, the syntactic context disambiguates uses that refer to different entities. Thus, there are separate name spaces for various categories of identifiers, as follows:
- label names (disambiguated by the syntax of the label declaration and use);
関連URL