Thursday, August 28, 2008

What are far, huge and near qualified pointers?

far, huge and near are non-standard qualifiers that were only used in 16 bit compilers like Turbo C/C++(DOS versions). A near qualified pointer is 16 bits in size and can access data within the 64kb data segment, while far and huge pointers can access data in other segments as well. A far pointer is 32 bits in size, of which the first 16 bits is for the segment address and the other 16 bits is for offset address. A huge pointer is normalized pointer and so its address can range beyond one segment.

These qualifiers are not available in the new 32 and 64 bit compilers (like VC++ and gcc) because they use flat memory model where memory is not divided into different segments, so these compilers do not have or require such qualifiers.

0 comments: