且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在未限定名称查找期间找到的声明

更新时间:2023-11-09 20:06:22

该子句声明名称查找停止,当它命中 int a = 5;

That clause says that name lookup stops when it hits int a=5;

在全局命名空间中只有一个名称, a 。它不含糊,因为只有一个 a ,如果有多个声明 a 没有关系。两个声明,一个名字。 (模糊情况只能发生在类成员名称查找,这在该部分中有更充分的描述)。

There is only one name here, a in the global namespace. It's not ambiguous because there is only one a, it doesn't matter if there are multiple declarations of a. Two declarations, one name. (The "ambiguous" case can only occur for class member name lookup, which is more fully described in that section).

我从你的措辞期望有某种不同的行为取决于1或2是否满足这条款;但没有。

I get the sense from your wording that you are expecting there to be some sort of different behaviour depending on whether 1 or 2 satisfies this clause; but there isn't.