What are DWord Word Fixed32u and Fixed32s used for?
What are DWord Word Fixed32u and Fixed32s used for?
DWord and Word are pretty common data types when working with windows. As for Fixed32u and Fixed32s I would assume that Fixed32u would be an unsigned fixed point data type and Fixed32s would be the same thing but signed. Fixed point numbers are used for a limited amount of precision without a ton of overhead. I'm sure they are all just typedefs so don't worry about using them.
Please, more detail on Word and Dword!
word = unsigned short/unsigned short int (16 bit unsigned)
dword = unsigned long (32 bit unsigned)
not always...Originally posted by Monster
word = unsigned short/unsigned short int (16 bit unsigned)
dword = unsigned long (32 bit unsigned)
The importance of word and dword are the amount of space they take up in bytes. A word is guaranteed to be 2 bytes and a dword (double word) is guaranteed to be 4 bytes. Neither is guaranteed to be equal to a short int or int and neither is guaranteed to take up a certain size in bits, only bytes.
In C an int isn't necissarily 4 bytes and a short isn't necissarily 2 bytes. All that is required is that a short is greater than or equal to 1 byte and an int is greater than or equal to the sizeof a short int.
Using word and dword insure that you are using the proper amount of bytes. There are lots of uses for this, namely portability, file io, and dynamic linking.
Let's say that in your program and one of your variables MUST be a certain size in bytes. On different compilers (or newer versions of the same compiler), an int can be a different size than the one you are using. If, however, you use word or dword, you know that you are using the right amount of space.
It's also beneficial in binary file io when you have to put into a file or take from a file some data that is a certain size.
With dynamic linking, the same concept holds as for portability. You have to make sure that the functions being dynamically linked and the applications using those functions are communicating variables of the same size, otherwise, they won't be able to use the functions.
Last edited by Polymorphic OOP; 02-04-2003 at 06:45 AM.