What is meant by Near, Huge and Far Pointers in C programming

CWC
3 Min Read

Near, far and huge pointers are old terms that have majorly used in Intel architectures in those earlier days of ms ad dos. The idea about this pointers can be traced back computer CPUs were having a very small address and RAM, and therefore there was a need to have a way to improve waging so as to improve your computer working. Every term had its different meaning, and it performed its particular task. In this article, we are going to look at every team and its purpose when it comes to c programming.

For 16 bit Intel architecture, virtual address has two components, selector and offset.
Selector is an index into a table of base address. Near pointers have implied selector, they can access 64k of virtual address space.
Far pointers have explicit selector, but selector does not change when far pointer is incremented/decremented. Huge pointers have explicit selector and selector can change when far pointer is incremented/decremented.

Near pointer

This is the pointer that is used to bit address of up to 16 bits in a given section of the computer memory that is 16 bit enabled. The main demerit of this bit is that it can only access data of a small size of about 64 kb in a given period.

A far pointers

This is a 32-bit pointer, and it can access information that is outside the computer memory in a given section. For one to use this pointer, he or she must allocate his sector register to store data address in the sector and also another sector register must be stored within the most recent sector.

Huge pointer

This pointer has the same size to that of a far pointer, and it can also access bits that are located outside the sector. Unlike to far pointer, this pointer which is fixed and hence that part of the sector in which they are located cannot be modified in any way; huge pointers can be. The pointer was seen to be somehow slow, but it allow its pointer to points out many segments with a clear and comparable way

Difference between a far pointer and a near pointer

In a near pointer, it uses offset data address in a segment default while a far pointer uses both sector data address and offset data address and it locates the data in the computer memory.

 

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version