声明区域和范围之间有什么区别 [英] What's the difference between declarative region and scope

查看:1046
本文介绍了声明区域和范围之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于声明区域:


每个名称都是在程序文本的一部分中引入的,名为
声明区程序的最大部分,其中
的名称有效

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.

它们之间的区别是什么?

What is the differences between them?

推荐答案

声明区是一个地方其中可以声明名称它们可以在块,类体中或在命名空间的体中声明。

A declarative region is a place where names can be declared in. I.e. they can be declared in a block, a class body, or in the bodies of a namespace, etc.

范围只是程序文本的一部分。如果你说这个名称的范围,这个短语是指程序文本的部分,这个名称可以使用名称不合格的形式找到。

A scope is just some snippet of program text. If you say "the scope of this name", this phrase refers to the part of the program text that this name can be found using the names unqualified form.

目前这些两个字词在标准中有缺陷,并且有一个长期有效问题以修复这些缺陷。

Currently these two terms are in defective form in the standard, and there is a long standing active issue to fix these defects.

这篇关于声明区域和范围之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆