Howdy, Stranger!

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

Categories

what's the meaning of 'far'

ligangligang Member Posts: 76
In Microsoft C :

char far var1[10] = "SDADSD";

what's the meaning of far

Comments

  • DariusDarius Member Posts: 1,666
    : 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

  • Justin BibJustin Bib USAMember Posts: 0

    _____ / http://forcoder.org / free video tutorials and ebooks about / Java C++ Ruby Visual Basic .NET Assembly Perl Scratch Delphi R Swift PHP Python MATLAB C# JavaScript C Visual Basic PL/SQL Objective-C Go Clojure SAS Bash FoxPro Apex COBOL ML Awk Crystal VBScript Fortran Prolog Lisp D Dart Transact-SQL Lua Rust Alice LabVIEW ABAP Hack Ada Scheme Logo Scala Kotlin Erlang Julia F# / _________

Sign In or Register to comment.