首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

word是2个字节长没错吧?该怎么处理

2012-02-04 
word是2个字节长没错吧?在C++ Primer 英文第4版P35页有一句话:Although the exact sizes can vary from on

word是2个字节长没错吧?
在C++ Primer 英文第4版
P35页有一句话:
Although the exact sizes can vary from one machine to another, we ususally refer to a chunk of 8 bits as a "byte" and 32bits, or 4 bytes, as a "word".

还有P34页:
Typically, shorts are represented in half a machine word, ints in a machine word,

为什么说word是4个字节呢?

在windef.h定义如下:
typedef unsigned long DWORD;
typedef unsigned short WORD;

是不是primer的word不作WORD理解?



[解决办法]
注意Typically

Windows 9x/Nt最开始需要和16位Windows代码级兼容,所以不能随便把WORD长度变了
[解决办法]
字长是根据机器来说的,32位机的字长就是32位,64位机的字长就是64位。跟你说的word、byte不同。
[解决办法]
a machine word not "word"

LZ理解有误啊

shorts are represented in half a machine word, ints in a machine word

这里说的是short类型占半字(2byte), int类型占一字(4byte)

表述word类型的时候通常是"word"

热点排行