Jump to content
  • Advertisement
Sign in to follow this  
eben

Various Questions Relating to DirectX and General C++

This topic is 4768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a few questions about various things...
typedef struct IDirectDrawSurface7      FAR *LPDIRECTDRAWSURFACE7;

1) In the above declaration what does FAR mean? 2) Secondly why are so many things in MS libs "long pointers". All the items they point to are complex objects and surely couldn't all be 32 bits long. I understand the windows is a 32bit OS, and 32bit math is fastest on a 32bit processor; but I hope you can see my confusion as to why so many things are refered to by a "long pointer" 3) Lastly, why do we use memset when dealing with surfaces? What is the virtue of filling a certain section of memory with dummy characters before being able to use a surface in that location?

Share this post


Link to post
Share on other sites
Advertisement
FAR is a hold over from the 16-bit days of windows programming. In Win32 programmng the FAR is more or less ignored. In the 16-bit days, a FAR pointer referred to a pointer that could point into any data segment. It's kept in the Windows APIs in the unlikely event that a future version of Windows will run on a segmented architecture again.

Long pointers are basically the same deal as far pointers. They meant a pointer that has the same amount of storage as a long int. (That's not really the case in x86-64 though.)

Share this post


Link to post
Share on other sites
Quote:
Original post by eben
2) Secondly why are so many things in MS libs "long pointers". All the items they
point to are complex objects and surely couldn't all be 32 bits long. I understand the windows is a 32bit OS, and 32bit math is fastest on a 32bit processor; but I hope you can see my confusion as to why so many things are refered to by a "long pointer"


I think I may have found my own answer to this question, tell me if I am correct. Is it because the first 32-bit value of MS written structures are their size? This way the 32-bit long pointer to them can find out the actual size then be adjusted?

ie.

typedef struct _DDSURFACEDESC2
{
DWORD dwSize; //ddsd.dsSize = sizeOf(DDSURFACEDESC2)
...
}


So how is my guess, am I hot or cold?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!