what's the meaning of 'far'

In Microsoft C :

char far var1[10] = "SDADSD";

what's the meaning of far


  • : In Microsoft C :
    : char far var1[10] = "SDADSD";
    : what's the meaning of far

    far means you need to get an up-to-date compiler and target an up-to-date OS.

    More seriously though (though I do mean what I just said), far is a C extension necessary for real-mode (read DOS) programs. In real-mode memory is organized in 64kb, largely overlapping, segments. The total amount of memory addressable (and therefore accessible) in real-mode is 1MB (actually slightly more than this). Memory is considered "near" if it is accessible in the current data segment, if it's not then a explicit segment will need to be specified and the data is considered "far". The compiler handles most of this for you and for small simple programs about the only time you need to use far is if you need to use a library function that expects a far pointer. For more memory intensive apps (though not by todays standards) you'll start needing far/huge pointers, and for even more memory-intensive programs you'll need to use a protected-mode extender, or go through XMS, or just target an up-to-date operating system and forget all this DOS trash.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion