Compiler  1.6.5 —1.6.7

Dynamic Scope

Technically, any scoping policy is dynamic if it is based on factor(s) that can be known only when the program executes.

如果作用域策略只有在程序执行时才知道,那么该作用域策略就是动态的。

A  use of a name x refers to

the declaration of x in the most recently called procedure with such a declaration.

一个x的使用指的是最近被调用得车工序用了这样一个声明的x的声明。

我们考虑两种动态策略的例子:

c预处理的宏扩展和面向对象的方法解析。

declarations and definitions

The apparently similar terms "declaration" and "definition" for program ming-language concepts are actually quite different. Declarations tell us about the types of things, while definitions tell us about their values . Thus, int i is a declaration of i, while i = 1 is a definition of i.

int i is a declaration of i ,while i =1 is a definition of i .S

In fact, in order to interpret x, we must use the usual dynamic-scope rule. We examine all the function calls that are currently active, and we take the most recently called function that has a declaration of x. It is to this declaration that the use of x refers.

为了解释x,我们必须用动态范围规则。 我们检测所有那些现在已经激活的韩硕地套用。我们选声明x的最近的函数调用。

Dynamic scope resolution is also essential for polymorphic procedures ,those that have two or more definitions  for the same name ,depending only on the types of the arguments .

Analogy Between Static and Dynamic Scoping

In a sense, the dynamic rule is to time as the static rule is to space. While the static rule asks us to find the declaration whose unit (block) most closely surrounds the physical location of the use, the dynamic rule asks us to find the declaration whose unit (procedure invocation) most closely surrounds the time of the use.

1.6.6 parameter passing mechanisms

参数传递机制

In this section, we shall consider

how the actual parameters (the parameters used in the call of a procedure) are associated with the formal parameters (those used in the procedure definition ).

The great majority of languages use either "call-by-value," or "call-by-reference," or both. We shall explain these terms, and another method known as "call-by-name," that is primarily of historical interest.

最主要的事值调用和引用调用。历史上还有名字调用。

Call-by-value has the effect that all computation involving the

formal parameters done by the called procedure is local to that procedure, and the actual parameters themselves cannot be changed.

However,that in c we can pass a pointer to a variable to allow that variable to be changed by the collee.

然而在c中可以传递一个指针给一个变量以此来允许变量被调用者改变。

因此值传递可以通过指针来改变实际变量。

Call-by-reference

In call-by-reference, the address of the actual parameter is passed to the cailee as the value of the corresponding formal parameter.

在引用调用中,实际参数的地址传递给了被调用着 对应的形式参数。

Uses of the formal parameter in the code of the callee are implemented by following this pointer to the location indicated by the caller.

在被调用处,使用形式参数是实际参数的地址。

Changes to the formal parameter thus appear as changes to the actual parameter.

1.6.7 Aliasing 别名

It is possible that two formal parameters can refer to the same location;

两个参数可能指向同一个地址。

such variables are said to be aliases of one another. As a result, any two variables, which may appear to take their values from two distinct formal parameters, can become aliases of each other, as well.

如果任意两个变量,可能获取数据来源于两个不同的参数,可能是相互之间的别名。

Compiler 1.6.5 —1.6.7的更多相关文章

  1. Java compiler level does not match解决方法

    从别的地方导入一个项目的时候,经常会遇到eclipse/Myeclipse报Description  Resource Path Location Type Java compiler level d ...

  2. idea报错:error java compilation failed internal java compiler error

    idea下面报如下问题 error java compilation failed internal java compiler error 解决办法:Setting->Compiler-> ...

  3. 使用Google Closure Compiler高级压缩Javascript代码注意的几个地方

    介绍 GCC(Google Closure Compiler)是由谷歌发布的Js代码压缩编译工具.它可以做到分析Js的代码,移除不需要的代码(dead code),并且去重写它,最后再进行压缩. 三种 ...

  4. SSE指令集学习:Compiler Intrinsic

    大多数的函数是在库中,Intrinsic Function却内嵌在编译器中(built in to the compiler). 1. Intrinsic Function Intrinsic Fun ...

  5. c++ builder 2010 错误 F1004 Internal compiler error at 0x9740d99 with base 0x9

    今天遇到一个奇怪的问题,拷贝项目后,在修改,会出现F1004 Internal compiler error at 0x9740d99 with base 0x9 ,不管怎么改,删除改动,都没用,关闭 ...

  6. Android requires compiler compliance level 5.0 or 6.0. Found '1.4' instead的解决办法

    今天在导入工程进Eclipse的时候竟然出错了,控制台输出的是: [2013-02-04 22:17:13 - takepicture] Android requires compiler compl ...

  7. Compiler Error Message: CS0016: Could not write to output file 回绝访问

    Compiler Error Message: CS0016: Could not write to output file 'c:\Windows...dll' 拒绝访问 C:\Windows\Te ...

  8. idea Error:java: Compilation failed: internal java compiler error

    idea 遇到Error:java: Compilation failed: internal java compiler error 是提示说你当前使用的编译器jdk版本不对. 按住Ctrl+Alt ...

  9. 关于The C compiler "arm-none-eabi-gcc" is not able to compile a simple test program. 的错误自省...

    在 GCC ARM Embedded https://launchpad.net/gcc-arm-embedded/ 上面下载了个arm-none-eabi-gcc 用cmake 编译时 #指定C交叉 ...

  10. java compiler level does not match the version of the installed java project facet 解决方案

    项目出现 java compiler level does not match the version of the installed java project facet 错误,一般是项目移植出现 ...

随机推荐

  1. 百度Fex webuploader.js上传大文件失败

    项目上用百度webuploader.js上传文件,option选项里面已经设置单个文件大小,但是上传低于此阈值的文件时仍然不成功. 我现在的理解是,框架是将文件post到后台服务器端的.. 百度发现是 ...

  2. TCP Operational Overview and the TCP Finite State Machine (FSM) http://tcpipguide.com/free/t_TCPOperationalOverviewandtheTCPFiniteStateMachineF.htm

    http://tcpipguide.com/free/t_TCPOperationalOverviewandtheTCPFiniteStateMachineF.htm   http://tcpipgu ...

  3. Java内部类用法

    内部类可以是静态(static)的,可以使用 public.protected 和 private 访问控制符,而外部类只能使用 public,或者默认. 成员式内部类 在外部类内部直接定义(不在方法 ...

  4. springMVC实现基本文件夹压缩下载功能

    将文件夹压缩后下载: @Slf4j public class Test { private static final String BASE_PATH = "/root/doc/" ...

  5. 关于CentOS 7安装solr+tomcat

    1.Solr7.1.0 安装部署(centos7) Solr7.1.0为目前的最新版,安装环境需要jdk1.8 或者更高,容器我用的tomcat,也建议tomcat8.0或者更高 1.1.下载solr ...

  6. 美化console.log的文本(转载)

    原文地址:http://www.css88.com/archives/5260 JavaScript Console 那些少人所知的特性 console.log("%c css88.com& ...

  7. centos6中office及中文输入法安装 (转载)

           原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xuxuezhe.blog.51cto.com/1636138/73 ...

  8. 洛谷 P2763 试题库问题【最大流】

    s向所有类别属性连流量为当前类别属性需要的个数的边,所有题目向t连流量为1的边(表示只能选一次),所有属性向含有它的题连容量为1的边.跑一变dinic,结果小于m则无解,否则看每一个类别属性连出去的题 ...

  9. (DP ST表 线段树)51NOD 1174 区间中最大的数

    给出一个有N个数的序列,编号0 - N - 1.进行Q次查询,查询编号i至j的所有数中,最大的数是多少.   例如: 1 7 6 3 1.i = 1, j = 3,对应的数为7 6 3,最大的数为7. ...

  10. php实现rpc简单的方法

    rpc是啥这不多解释,php扩展实现rpc yar是鸟哥的写的扩展,实现简单的rpc.比较很好理解 windows安装yar http://pecl.php.net/package/yar/2.0.4 ...