Thread: Data types

  1. #1
    Registered User
    Join Date
    Nov 2001

    Data types

    What are DWord Word Fixed32u and Fixed32s used for?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA
    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.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Please, more detail on Word and Dword!

  4. #4
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    word = unsigned short/unsigned short int (16 bit unsigned)
    dword = unsigned long (32 bit unsigned)

  5. #5
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Originally posted by Monster
    word = unsigned short/unsigned short int (16 bit unsigned)
    dword = unsigned long (32 bit unsigned)
    not always...

    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extending basic data types.
    By nempo in forum C++ Programming
    Replies: 23
    Last Post: 09-25-2007, 03:28 PM
  2. Replies: 4
    Last Post: 06-14-2005, 05:45 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM
  5. Using enumerated data types
    By SXO in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2001, 06:26 PM