問題描述
我們常用的指針(我們通常使用的指針)、近指針和遠指針之間有什么區別?近指針和遠指針在當今的 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 :-)
這篇關于遠近指針的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!