word是2个字节长没错吧?

qualcode 2012-01-27 10:48:00
在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理解?

...全文
441 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shnaying1945 2012-01-28
  • 打赏
  • 举报
回复
字长是根据机器来说的,32位机的字长就是32位,64位机的字长就是64位。跟你说的word、byte不同。
RLib 2012-01-28
  • 打赏
  • 举报
回复
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"
bluewanderer 2012-01-27
  • 打赏
  • 举报
回复
注意Typically

Windows 9x/Nt最开始需要和16位Windows代码级兼容,所以不能随便把WORD长度变了

64,281

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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