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 :-)
这篇关于远近指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:远近指针
基础教程推荐
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- c++ STL设置差异 2022-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
