What are far and near pointers?

Questions by savithavelu   answers by savithavelu

Showing Answers 1 - 2 of 2 Answers

subitech

  • Jan 5th, 2007
 

Pointers can either be near, far, or huge. Near pointers refer to the current segment, so neither DS nor CS must be modified to dereference the pointer. They are the fastest pointers, but are limited to point to 64 kilobytes of memory (the current segment).

Far pointers contain the new value of DS or CS within them. To use them the register must be changed, the memory dereferenced, and then the register restored. They may reference up to 1 gibibyte of memory. Note that pointer arithmetic, such as addition and subtraction, if done directly, never modify the segment portion of the pointer, only its offset until the new offset exceeds 0xFFFF or is under 0.

Huge pointers are essentially far pointers, but are normalized every time they are modified so that they have the smallest possible segment for that address. This is very slow and is harder and even slower in protected mode, but allows the pointer to point to multiple segments, and allows for accurate pointer comparisons, as if the platform were a flat memory model.

hi i just searched and got this answer from wikipedia Hope this helps you

A Null pointer is one which does not refer to any thing
Far pointer refers to an address which not in the same segment where pointer is defined.
Near pointer refers to an address in the same segment where the pointer is defined


Regards
Mulay Chetan

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions