问题描述
我们常用的指针(我们通常使用的指针)、近指针和远指针之间有什么区别?近指针和远指针在当今的 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 :-)
这篇关于远近指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!