English 中文(简体)
采用类型法的协同解释
原标题:Syntax explanation using typedef
  • 时间:2012-01-12 06:17:34
  •  标签:
  • c++

I want to understand why FAR is used in the below typedef syntax?

#define FAR
//some other instructions
//.....
//.....

typedef struct tagDEVICE_BUFFER_W
{
 ....
 ....
}DEVICE_BUFFER_W;

typedef DEVICE_BUFFER_W FAR * LPDEVICE_BUFFER_W; //Why FAR is used here?

如下文所述,我是否打算使用FAR? 它是否会有任何改变?

typedef DEVICE_BUFFER_W * LPDEVICE_BUFFER_W;
最佳回答

It s legacy from the olden days. 16-bit Windows code had near and far pointers. I think it was to distinguish between inter-segment and intra-segment addressing, but the memory has faded (a lot).

问题回答

我实际上不知道谁是谁,因此我只想把你带到瓦基佩亚。 正如马塞洛说过的,这似乎已经过时,而且是一种遗留的技术。

See here for the Wikipedia article.

此外,从programming Forum(与Daniweb thread链接):

在80286年的老日里,有近(16比)和远(16:16=20/24比)。 由于X86的16个轨道性质,纪念物被划分为64克(16个轨道)。 地址公共汽车支持20至24条轨道(1-16AB),以便处理大面积的问题,部分登记与16个轨道点人合并组成完整地址。 这一结构今天仍然存在,但已经成为一个非问题。 视像器使用一个“参考”传记模式,所有部分都指同一地点,而不是16倍的冲销,有32倍的冲销。 卢旺达武装部队的关键词在现代X86软件中变得不必要。

它可能不会对这一具体执行产生任何影响,而是在一个能够用来界定额外信息的不同的操作系统或结构上发挥作用。 在本案中,它可能被用于far Pointers:

#define FAR far




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签