far函数指针的语法是什么," far"的用法是什么?在下面给出的c语言的声明中?他的陈述中使用了多远?
int (far *directCall_setBank)(void);
int VBE_getModeInfo(short mode) {
VBE_ModeInfoBlock modeInfo; //Temporary holding space for returned VBE info
REGS r; //Register structures for passing to 'int86x()'
SREGS s; //(SREGS includes the segment registers)
r.x.ax=0x4F01; //AL = 0x01, "get VBE Mode Info"
r.x.cx=mode; //CX = mode to get info for
r.x.di=FP_OFF(&modeInfo); //address ES:DI to our ModeInfoBlock structure
s.es=FP_SEG(&modeInfo); //so that the VBE driver will fill its values
int86x(0x10,&r,&r,&s); //call interrupt 0x10 (through a C function call)
screen_width=modeInfo.resX; //Store the values returned in
screen_height=modeInfo.resY; //'modeInfo'
directCall_setBank=modeInfo.winFuncPtr; //INCLUDING the pointer to our function
return((int)r.h.ah); //Return the VBE status in AH
}
答案 0 :(得分:2)
它用于dos时代,非常适合机器(内存模型)。为了保持C独立于特定的体系结构,C从不接受标准语言中的far关键字,但它仍然可以作为一些编译器的扩展。