I have read about the near, far and huge pointers in many text books. Most of them were not helpful. In this post I just want to give you some basic ideas about them.
- The near, far and huge pointers are not part of the standard C Programming language. Even if you haven't heard about them, it doesn't make you less of a C programmer.
- They are only relevant in case of 16 bit Intel Architectures. So these pointers are mostly a relic of the past without any proper use nowadays. I still remember the time when I used some of the functions in Turbo C Compiler to copy the memory content. I was unsuccessful in my attempt since my system was having a 32 bit architecture. So these pointers are not useful with most of today's machines.
- Only 16 bit Compilers like Turbo C++, Borland C++, etc. have support for these compilers nowadays.
- They were mainly used to deal with segmented memory architectures.
far pointer
A far pointer is a 32-bit pointer and contains both a segment address and an offset address.
huge pointer
A huge pointer is also 32-bit pointer and contains both a segment address and an offset address. When a far pointer is incremented or decremented ONLY the offset of the pointer is actually incremented or decremented but in case of huge pointer both segment and offset value will change.
near pointer
A near pointer is a 16-bit pointer. The current content of the Code Segment or Data Segment is used as the segment part and near pointer contains the offset part.
This comment has been removed by a blog administrator.
ReplyDeleteWhat is segmented memory architectures?
ReplyDelete