Near and Far pointers(远近指针)
问题描述
我们常用的指针(我们通常使用的指针)、近指针和远指针之间有什么区别?近指针和远指针在当今的 C/C++ 系统中是否有实际用途?任何需要使用这些特定指针而不是其他 c、c++ 语义的实际场景都将非常有帮助.
What is difference between our usual pointers(ones which we normally use), near pointers and far pointers and is there a practical usage for near and far pointers in present day C/C++ systems? Any practical scenario which necessiates use of these specific pointers and not other c,c++ semantics will be very helpful.
推荐答案
near 和 far 关键字起源于 Intel 之前的分段内存模型.Near 指针只能访问一个最初大小约为 64Kb 的内存块,称为段,而远指针可以超出该范围,该范围由段和该段中的偏移量组成.Near 指针比 far 指针快得多,因此在某些情况下使用它们是值得的.
The near and far keywords have their origin in the segmented memory model that Intel had before. The near pointers could only access a block of memory originally around 64Kb in size called a segment whereas the far pointers could go outside of that range consisting of a segment and offset in that segment. The near pointers were much faster than far pointers so therefore in some contexts it paid off to use them.
现在使用虚拟内存,near 和 far 指针已经没有用处了.
Nowadays with virtual memory near and far pointers have no use.
对不起,如果我没有使用正确的术语,但这是我在当天使用它时的记忆:-)
Sorry if I am not using the correct terms, but this is how I remembered it when I was working with it back in the day :-)
这篇关于远近指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:远近指针
基础教程推荐
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01