   what does "FAR *" mean in a structure definition ??    
  Hi all,while browsing in some source code I came up on this...typedef struct TILE_type{    RECT rcLocation;    // location on DirectDraw surface    int bWalkOK;   // can the tile be walked on?    int nAnimSpeed;// animation speed in frames    DWORD dwFlags; // approach flags    TILE_type *lpNext;  // next tile in animationUINT uiFrames; // frame counter} TILE, FAR* LPTILE;  In his main program he then declared two objects :TILE Tile;LPTILE lpTile; // this should be a pointer to the structure, right ?? but why does he need a pointer ???Then he sometimes uses Tile.rcLocation or lpTile->rcLocation to access the structures members...why does he do that ?? what are the advantages ?? i can't seam to find it on msdn...Thanks in advance !!    [edited by - HolyFish on August 20, 2002 12:47:24 PM][edited by - HolyFish on August 20, 2002 12:47:51 PM][edited by - HolyFish on August 20, 2002 12:48:14 PM]
  FAR * is a holdover from the days of 16 bit windows. It''s a little odd to see this overlap in a directdraw application... How old is this code, do you think?Anyway, there''s little reason to use FAR * in win32.  ;  To explain a bit further, on 16-bit platforms because pointers are 16-bits, you can only address 65536 bytes of memory, unless you do some dirty tricks.  The dirty trick is to split memory into what is called "segments" of 65536 bytes each, so you would have something like:video_buffer = (unsigned char far *)0xA0000000L;This is often written as A000:0000, where A000h is the segment number/address.  I forget the syntax if you are pointing to a memory location in the current segment, it was something like (uchar near *)0000h  or just (uchar *)0000h.A thing you will see a lot in Windows code is this:   typedef int INT;typedef INT * LPINT;INT a;LPINT lpA = &a  There are several reasons one might want to do this, especially if you are writing an application that may be deployed on different processor types where an INT is not necessarily 4 bytes, or a pointer is not necessarily 4-bytes.  Windows has been released at least on 16, 32, and 64 bit systems, I''m not sure what else.Personally, I never typedef pointers this way, unless I''m dealing with long complex function pointers.  You can take "far" to mean nothing in 32-bit windows.  In 16-bits its very important.  I understand 64-bit windows has seen the re-introduction of segments, but it is very rarely used.  ;  To elaborate on what Z01 wrote and to get to the heart of the question. A far pointer was capable of referencing memory outside of the current 65335 byte segment. Someday you might also run across a pointer declared as "near" - that means it was intended to reference a memory address in the 65535 byte segment of which it was a part. In 32 bit windows all this is moot, because every pointer is "far". Each process has a 4 Gb virtual address space (2^32 == 4 Gb) - this is called "flat" addressing. And if you get into assembly programming and come across small, large, huge memory models (etc.)  terminology relates to this 16 bit segmentation issue as well. Another side effect of "near" and "far" that has carried over is the hungarian "lp" notation applied to pointers. "lp" - long pointer - identifies the pointer as a 32 bit pointer rather than a 16 bit pointer.   ;  FAR is a macro that expands to nothing on Win32, it is only used on Win16.  ;  ok, thanks all for the replies !!Thay have all been very helpfull.O yeah, the code extract is from the "Game programming Genesis" tutorial from Gamedev...  