gpt4 book ai didi

c++ - 声明区域的实际定义是什么

转载 作者:搜寻专家 更新时间:2023-10-31 01:44:19 25 4
gpt4 key购买 nike

<分区>

标准中引用了 sec 3.3.1/1:

Every name is introduced in some portion of program text called a declarative region, which is the largest part of the program in which that name is valid, that is, in which that name may be used as an unqualified name to refer to the same entity.

还有来自标准 sec 3.3.1/2 的示例

int j = 24;
int main()
{
int i = j, j;
j = 42;
}

the identifier j is declared twice as a name (and used twice). The declarative region of the first j includes the entire example. The potential scope of the first j begins immediately after that j and extends to the end of the program, but its (actual) scope excludes the text between the , and the }.

但是这两段在声明区域定义中是矛盾的,因为 j 可能不会在整个示例中使用,因为非限定名称 ro 指的是同一个实体

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com