Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEAR and FAR...

Status
Not open for further replies.

CubeE101

Programmer
Nov 19, 2002
1,492
0
0
US
I know this is a simple question but...

Are NEAR & FAR the same as Private & Public in VB, vc++ & java, respectively?

where the scope of near / private is limited to the current module and Far / Public is not limited to the module?


Have Fun, Be Young... Code BASIC
-Josh Stribling
cubee101.gif

 
The behaviour of NEAR and FAR can roughly be compared with private/public, but it's not the same.

A NEAR memory reference assumes that the address you need is in an active memory segment of which the base address is stored in a register (the reference is "private" to the current code/data segment). If you want to reference an address in another segment, you have to specify the segment base: a FAR reference ("public" because the reference can be accessed at any time from any location).
Private and public, on the other hand, belong to an artificial programming approach, in essence all functions are public, only the compiler prohibits you to use them so. In practice, however, private functions will usually be defined NEAR and public functions FAR. Optimizing compilers (like C++ with option -O3) can produce machine code depending on the use of the source code, so in some cases public data may also be NEAR.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
there is an FAQ stating a URL where to download the intel manuals. These manuals explain everything about the programming assemly on the 80x86 and specifically explains the differences of what occurs and how the processor reacts when near and far opcodes are used.

and ofcorse a whole lot more ;)
straiph



"There are 10 types of people in this world, those who know binary and those who don't!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top