THX~
THX~
far is a area of memory that is outside of the usual 16-bit (64k) of program memory.
DOS programs run in 16-bit, hence 64k of program memory (known as 'near' memory),If you declare an array of 68k in a 16-bit program, you will get a compiler error.
FAR is used to tell the compiler that the data is to be placed outside of this program memory limitation, and in the system memory.
This can also be expanded, and can be used to declare a FAR pointer to an address outside on the 64k (e.g. a LPT port)
Code:// near and far arrays: char Buffer[68000]; // compiler error in win16 char _far Buffer[68000]; // compiler ok.
NOTE! in win32 programs, we use 32-bit pointers, and therefore ALL pointers are FAR pointers by default, we are not limited to 64k.
joe
#
Actually its used all the time for embedded systems that rely on the old 16-bit dos platform.Originally posted by Salem
A redundant keyword for a forgotten compiler, running on a fossil operating system
But for all those that dont program dos, then i guess the last time you typed FAR was when you emailed the boss with your program progression report... "not FAR to go now..."
joe
#
my only current work with far involves taking it OUT of code. It's defined as nothing now. There are a ton of things in Win32 that are defined as nothing and are just used to annoy me. IN and OUT for instance are supposed to be helpful in making a parameter list descriptive. I hate them. for instance:
void FuncName(int IN a, int IN b, int OUT *c);
it can be seen as helpful in readability but it means nothing.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
lol, my only encounter with NEAR and FAR pointers is as FillYourBrain said, is with removing it
I've never in my time of programming used NEAR and FAR pointers.
well, some of us still have to use them for DOS programming
joe
#
use djgppOriginally posted by kybert
well, some of us still have to use them for DOS programming
joe
#
hello, internet!