什么是长指针? [英] What is a long pointer?

查看:351
本文介绍了什么是长指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一本书,它提到特定的数据类型为是长指针。只是好奇是什么意思。谢谢你。

I am reading a book and it mentions certain data type as being long pointer. Just curious about what that meant. Thanks.

推荐答案

一些处理器有两种类型的指针,近指针和远指针。近指针比远指针较窄(因而具有有限的范围内)。远指针也可能是一个长期的指针。

Some processors have two types of pointers, a near pointer and a far pointer. The near pointer is narrower (thus has a limited range) than a far pointer. A far pointer may also be a long pointer.

一些处理器提供相对寻址的事情附近。长指针可能表明该产品不是附近,相对寻址不能使用。

Some processors offer relative addressing for things nearby. A long pointer may indicate that the item is not close by and relative addressing cannot be used.

在任何情况下,长期的指针是特定于平台的问题,可能无法移植到其他操作系统或平台。

In any case, long pointers are a platform specific issue and may not be portable to other OSes or platforms.

编辑: (进一步的解释和相对寻址的使用)

地址距离少了高层次的概念,更是汇编语言的概念。在距离从程序计数器(无论是当前地址或下一个地址)和对象(函数或数据)开始测量。如果该位置是比小,相对的指针的极限时,较长的指针将是必要的。

Address distances are less of a high level concept and more of an assembly language concept. The distance is measured from the program counter (either the current address or the next address) and the start of the object (function or data). If the location is greater than the limit for a small, relative pointer, a longer pointer will be necessary.

实例:假设一个系统具有32位的长寻址和相对的8位寻址。相对距离将允许在向前(正值)的至少127个字节或previous(负)方向。如果目标是1024字节远,则必须使用一个完整的32位的指针。

Example: Given a system with 32 bit "long" addressing and 8-bit relative addressing. The relative distance would allow for at least 127 bytes in the forward (positive value) or previous (negative) direction. If the target is 1024 bytes away, a full 32-bit pointer must be used.

这是基于大多数指令和数据由接近概念的优化功能。大多数循环的有循环的开始和结束的环之间的小的距离。这些聘请相对寻址执行。

This is an optimization feature based on the concept that most instructions and data are near by. The majority of loops have a small distance between the start of the loop and end of the loop. These employ relative addressing for execution.

大多数数据是在附近,是否一个数据常数或变量。在更详细地说,该数据是附近的的或参考点。局部变量被放置在栈中,相对于一个框架或基地址。这个基址是栈的之前执行的功能的开始。因此,数据可以使用的寻址相对于栈帧开始进行访问。

Most data is nearby, whether a data constant or a variable. In more detail, the data is near a frame or reference point. Local variables are placed on the stack, relative to a frame or base address. This base address is the start of the stack before the function is executed. Thus the data can be accessed using addressing relative to the stack frame start.

该处理器使编译器可使用专用指令相对(附近)寻址。在许多的处理器,说明相对寻址使用比使用长地址的指令较小。因此,处理器需要从指令缓存和指令缓存可以容纳更多的指令少取。

The processors allow compilers to use specialized instructions for relative (near) addressing. On many processors, the instructions to use relative addressing are smaller than instructions using long address. Thus the processor requires less fetching from the instruction cache and the instruction cache can hold more instructions.

长与短,近而远,解决可能依赖于的范围的数据或功能。还有其他因素参与其中,这样的PIC(位置indepent code),虚拟内存和分页。

Long and short, near and far, addressing may depend on the scope of the data or function. There are other factors involved, such a PIC (position indepent code), virtual memory and paging.

这篇关于什么是长指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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