什么是远指针和近指针之间的区别? [英] What is the difference between far pointers and near pointers?

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

问题描述

能否有人告诉我之间的差别远附近在C指针的指针?

Can anybody tell me the difference between far pointers and near pointers in C?

推荐答案

要引用维基百科,

四个寄存器用来指
  在16位x86四个段
  分段存储器架构。 DS
  (数据段),CS(code段),SS
  (堆栈段)和ES(附加
  分割)。在这一个逻辑地址
  平台写入段:偏移,在
  十六进制。

Four registers are used to refer to four segments on the 16-bit x86 segmented memory architecture. DS (data segment), CS (code segment), SS (stack segment), and ES (extra segment). A logical address on this platform is written segment:offset, in hexadecimal.

近指针引用(作为补偿),以当前段。

Near pointers refer (as an offset) to the current segment.

远指针使用环节的信息和偏移指向跨段。因此,使用它们,DS或CS必须更改为指定的值时,内存将被解除引用,然后DS / CS的原始值恢复。注意对他们指针运算不修改指针的段部分,所以四溢偏移只是换过来。

Far pointers use segment info and an offset to point across segments. So, to use them, DS or CS must be changed to the specified value, the memory will be dereferenced and then the original value of DS/CS restored. Note that pointer arithmetic on them doesn't modify the segment portion of the pointer, so overflowing the offset will just wrap it around.

然后有巨大的指针,这是规范化有一个给定的地址(与远指针)。

And then there are huge pointers, which are normalized to have the highest possible segment for a given address (contrary to far pointers).

在32位和64位架构,内存模型采用分段方式不同,或根本没有。

On 32-bit and 64-bit architectures, memory models are using segments differently, or not at all.

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

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