gpt4 book ai didi

c++ - 声明区域和范围有什么区别

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:23:24 27 4
gpt4 key购买 nike

关于声明区域:

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

关于范围:

In general, each particular name is valid only within some possibly discontiguous portion of program text called its scope.

它们有什么区别?

最佳答案

声明区域是可以声明名称的地方。即它们可以在 block 、类主体或命名空间的主体等中声明。

范围只是程序文本的一些片段。如果说“这个名字的范围”,这个短语指的是程序文本中可以使用不合格的名字形式找到这个名字的部分。

目前这两个术语在标准中是有缺陷的形式,并且有一个long standing active issue来修复这些缺陷。

关于c++ - 声明区域和范围有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23630201/

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