qword, instead of __int64

Started by
6 comments, last by alnite 20 years, 11 months ago
I am reading an assembly programming book, and I just knew that in addition to dword, there is qword (quad word). word is 2 bytes, and is commonly associated with short. dword is 4 bytes, associated with long. qword is 8 bytes, but I never see it as a data type?
Advertisement
word/dword/qword are ASM datatypes. They are not officially defined in the C/C++ standard (the fact that MS uses them in the windows header files is another thing). QWORD is the ASM counterpart of __int64, and is commonly used in FPU code. You can always typedef qword to __int64, if you want.


[edited by - Yann L on May 7, 2003 2:09:43 PM]
Right. I can typedef it, but what I don''t understand is the fact that DWORD is widely used while QWORD is not.
QWORD isn''t used very much for two reasons.
1. You generaly don''t need a variable that large
2. Most of todays processors are 32bit NOT 64bit so QWORDs aren''t directly supported which makes them alot slower than using standard DWORDs
but there is __int64??
Also, I''ll bet if you want to use them (like simply printing one out) you''d have to write your own printing method.

Is there an already-written output function which accepts int64?
Again: WORD/DWORD & co. are not C/C++ types. They are ASM types, and QWORD is commonly used in ASM code. Microsoft happened to use those ASM types in C/C++, but that's about all. They could also have named them MS_short, MS_int, or Bill_Gates_int64. It was just a convenience typedef, to get machine independent types (there were DEC Alpha + MIPS versions of Win NT, not only x86).

quote:
Is there an already-written output function which accepts int64?

Uh, printf() or iostream ?


[edited by - Yann L on May 7, 2003 7:33:59 PM]
In VC++ 6, printf() accepts __int64, but only if specified thus:

__int64 i;
printf("%I64i", i);

This topic is closed to new replies.

Advertisement