Skip to main content
GameDev.net gamedev.net
🔒 Locked

Far pointers

Started by boltneck Oct 20, 2000 at 7:20 PM 2 replies 600+ views
Original Post
boltneck
boltneck
What are far pointers? never heard of them? I see them alot, especially in examples like this: unsigned char far *bitmap_data; thanx!!
SiCrane
SiCrane
far pointers are a legacy from when DOS ran on a 20 bit segment:offset memory model. Each memory segement was 64K, as long as your pointer pointed to something within the same segment, you only needed the offset half of the memory address. This was called a near pointer and only occupied 16 bits. A far pointer was necessary when you accessed something in a different segment. Then you needed to specify the segment and the offset of the location, which required 32 bits (16 for offset and 16 for segment). When we moved to Win32, memory got flattened so that every memory location required 32 bits to identify. So the far specifier became (essentially) obsolete. However, because of the joy of legacy code, far and near directives still have to be handled by the compiler.
boltneck
boltneck
Thank you so much for the info!
Zipster
Zipster
This is also where you here how Win2k is supposedly all 32-bit, etc., from the way it addresses memory.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.