void far xxx(......)这个far是干什么用的?是不是16位机器下特定的情况?32位下还用不用?请解释下,谢谢。

rujor 2005-03-02 09:31:47
void far xxx(......)这个far是干什么用的?是不是16位机器下特定的情况?32位下还用不用?请解释下,谢谢。
...全文
612 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
nonowhy 2005-03-03
  • 打赏
  • 举报
回复
呵呵,we are in the same field!
想你应该熟悉长跳转和短跳转的概念。far 的用处就是指定一个长跳转地址,仅此而已。
rujor 2005-03-03
  • 打赏
  • 举报
回复
我在我们嵌入式的代码里面,看到的全是far.
Cybergate 2005-03-03
  • 打赏
  • 举报
回复
在dos下访问扩展内存要调用特殊中断。far指针不能访问扩展内存。
Cybergate 2005-03-03
  • 打赏
  • 举报
回复
far 有没有用取决于操作系统的具体实现。win32下用的是平坦模式,每个进程提供对应一个独立的4G虚拟线性空间,以起到保护和隔离的作用。在这种情况下far没有甚么意义。但是对于采用分段机制的操作系统,不论是16位还是32位,都会有far这个关键字。

远指针在实模式下是32位,在x86保护模式下是48位。
zixiu2008 2005-03-03
  • 打赏
  • 举报
回复
far最早还是微软搞出的东西。
AmberSeason 2005-03-03
  • 打赏
  • 举报
回复
哦,我也是经常看到这个东东,就是一直不知道什么意思,各位能不能说的详细一点
little_paradise 2005-03-03
  • 打赏
  • 举报
回复
偶从来没用过
xuelong_zl 2005-03-02
  • 打赏
  • 举报
回复
传说中的远指针吗?

呵呵,它只是在16位机器下时,用于扩展内存寻址用.

对于现在的32位机器,这个东东已经不用考虑了,不用学了
winstonch 2005-03-02
  • 打赏
  • 举报
回复
MSDN中相关的一点说明.
The increased address-space size in 32-bit Windows impacts 16-bit code in several ways:

Pointers are all 32 bits wide and are no longer near or far, and your code cannot make assumptions based on segmented memory.
Window handles, handles to other objects (such as pens, brushes, and menus), and graphics coordinates have increased to 32 bits. Thus, you cannot use types such as WORD interchangeably with HWND as you could in 16-bit Windows.
Message handlers must be rewritten because the different sizes can change the way information is packed in some message parameters.
The larger size of graphics coordinates affects a number of function calls.
The key areas of 16-bit code affected by these changes are:

Window procedure declarations
Near and far type declarations
Data types
Messages
Calls to API functions
WinMain function
winstonch 2005-03-02
  • 打赏
  • 举报
回复
32位机已经不用了,在16位机的时候因为地址空间不足,所以有段地址的概念,这样就有了far.具体的也说不清了,很久以前的事了/

69,393

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧