问题描述
我关注有关引导加载程序的文章,
()
我发现这个部分:
I'm following article about boot loader,
( http://www.codeproject.com/KB/tips/boot-loader.aspx?msg=3745692#xx3745692xx )
and I found this part:
"const char far* inStrSource"
整个事物:
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
typedef char bool;
byte CString::Strlen( const char far* inStrSource )
{
byte lenghtOfString = 0;
while(*inStrSource++ != '\0')
{
++lenghtOfString;
}
return lenghtOfString;
}
任何人都可以解释我,为什么他将char类型定义为bool,这个指针事件发生了什么?
Can anyone explain me please, why does he define char type as bool, and what is going on with this pointer thing?
MVC ++ 10将这些视为错误(typedef char bool和char far * intSource),但是用16bit VC 1.52工程
MVC++ 10 recognize those as an error ( typedef char bool, and char far* intSource), however compiling with 16bit VC 1.52 works with no doubt.
推荐答案
这是一个:一个可以比< em>正常指针更长的指针(即:获取更多的位)。
It's a far pointer: a pointer which can be longer (ie: take more bits) than normal pointers.
它用于表示不能被正常指针寻址的存储单元(即:如果系统上的指针由8位组成,则只能引用最多2 ^ 8个存储单元;如果需要寻址更多内存你可以使用far指针)。
It's used to refer memory cells which couldn't be addressed by normal pointers (ie: if pointers on your systems are made of 8 bits, you can only refer up to 2^8 memory cells; if you need to address more memory you could use a far pointer).
这篇关于什么是“const char far * inStrSource”意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!