9

Possible Duplicate:
difference between far pointer and near pointer in C

I searched in GOOGLE for the difference between these three pointers. But I found out the difference between any of the two pointers.

Can you give Detailed Explanation of this please?

Community
  • 1
  • 1
Karai
  • 298
  • 2
  • 6
  • 14

2 Answers2

22

The differences are only relevant on 16 bit intel architectures.

As far as virtual addresses is concerned, It has two components - a selector and an offset.

The selector is an index into a table of base addresses and offset is added onto that base address.

near pointers don't have a selector - they have an implied selector. They can access 64k off the virtual address space.

far pointers have an explicit selector. However when you do pointer arithmetic on them the selector isn't modified.

huge pointers have an explicit selector. When you do pointer arithmetic on them though the selector can change.

Please Refer this link for more info:

http://www.codeproject.com/Answers/103115/near-vs-far-vs-huge-pointers/?cmt=11086#answer1

karthik
  • 17,453
  • 70
  • 78
  • 122
  • 3
    Aargh! I'm starting to remember all this stuff! (All the stuff with memory models too.) Make it go away! I moved to developing for 32-bit flat architectures only for good reason… – Donal Fellows Jan 04 '12 at 13:00
4

Near, far, and huge pointers aren't part of standard C; they are/were an extension put in by several vendors to deal with segmented memory architectures. Karthik's answer gives much more detail.

John Bode
  • 119,563
  • 19
  • 122
  • 198