All u wanted to know about data types&more

This is a discussion on All u wanted to know about data types&more within the Windows Programming forums, part of the Platform Specific Boards category; this might be helpful to some. It was to me. so enjoy. but why LONG. when there is a signed ...

  1. #1
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218

    All u wanted to know about data types&more

    this might be helpful to some.
    It was to me. so enjoy.

    but why LONG. when there is a signed int?they are the same
    in 32 bits.

    Code:
    
    Data Types
    Value Meaning 
    BOOL A 32-bit field that is set to 1 to indicate TRUE, or 0 to indicate FALSE.
     
    BOOLEAN An 8-bit field that is set to 1 to indicate TRUE, or 0 to indicate FALSE.
     
    BYTE An 8-bit block of data.
     
    CHAR An 8-bit block of data that typically contains a Windows (ANSI) character. 
    
    DWORD A 32-bit unsigned integer (range: 0 through 4294967295 decimal). Because 
    a DWORD is unsigned, its first (most significant) bit is not reserved for signing.
    
     
    GUID A globally unique identifier. This data type exposes the GUID structure 
    
    (documented in the Platform SDK), which contains the following:
    
    DWORD: Contains the first eight hexadecimal digits of the GUID identifier.
     
    WORD: Contains the first group of four hexadecimal digits of the GUID identifier.
     
    WORD: Contains the second group of four hexadecimal digits of the GUID identifier. 
    
    BYTE[]: An array whose first two bytes specify the third group of four
     hexadecimal digits, and whose remaining six bytes contain the 
    final 12 hexadecimal digits of the GUID identifier. 
     
    INT A 32-bit signed integer (range: -2147483648 through 2147483647 decimal).
     
    LARGE_INTEGER A 64-bit signed integer (range: -2305843009213693952
     through 2305843009213693952 decimal).
     
    LONG A 32-bit signed integer (range: -2147483648 through 2147483647 decimal). 
     
    LONGLONG A 64-bit signed integer (range: -2305843009213693952 
    through 2305843009213693952 decimal).
     
    LONG_PTR A 32-bit signed LONG for pointer precision.
     Use when casting a pointer to a LONG to perform pointer arithmetic.
     
    LPBYTE A 32-bit pointer to a BYTE. 
    
    LPCSTR A 32-bit pointer to a null-terminated 
    string of 8-bit Windows (ANSI) characters.
     
    LPCWSTR A 32-bit pointer to a null-terminated string of 
    16-bit Unicode characters. 
    
    LPDWORD A 32-bit pointer to a DWORD. 
    
    LPSTR A 32-bit pointer to a null-terminated string of 8-bit Windows (ANSI) characters. 
    
    LPWSTR A 32-bit pointer to a null-terminated string of 16-bit Unicode characters.
     
    OLD_LARGE_INTEGER A data type that exposes an OLD_LARGER_INTEGER structure, which contains the following:
    
    ULONG: The lower four bytes.
     
    LONG: The upper four bytes. 
     
    PWSTR A 32-bit pointer to a null-terminated string of 16-bit Unicode characters. 
    
    PUCHAR A 32-bit pointer to an unsigned CHAR.
     
    PULONG A 32-bit pointer to a ULONG.
     
    SHORT A 16-bit integer (range: -32768 through 32767 decimal).
     The first (most significant) bit is the signing bit.
     
    TCHAR A character that is a WCHAR if Unicode is defined, or a CHAR otherwise.
     
    TIME A 128-bit integer that represents an absolute time or a time interval.
     Times are specified in units of 100 milliseconds. This data type exposes the TIME structure, which contains the following:
    
    ULONG: The lower four bytes. 
    
    
    LONG: The upper four bytes. 
    A positive value expresses an absolute time, where the base time is
     the beginning of the year 1601 A.D. in the Gregorian calendar.
     A negative value expresses a time interval relative to some base time,
     typically the current time.
    
     
    UCHAR An 8-bit integer block of data (range: 0 through 255 decimal).
     Because a UCHAR is unsigned, its first (most significant) bit is 
    not reserved for signing.
    
     
    ULONG A 32-bit unsigned integer (range: 0 through 4294967296 decimal).
     Because a ULONG is unsigned, its first (most significant) bit is
     not reserved for signing.
     
    
    ULONGLONG A 64-bit unsigned integer (range: 0 through to 18446744073709551616 decimal).
     Because a ULONGLONG is unsigned, its first (most significant) 
    bit is not reserved for signing. 
    
    
    ULONG_PTR A 32-bit pointer to a ULONG.
     
    UNICODE_STRING A complex data type (documented in the Platform SDK) that consists of the following:
    
    USHORT: The length of the wide-character string in bytes.
     
    USHORT: The total size, in bytes, of memory allocated for
     the wide-character string buffer.
     
    PWSTR: Pointer to a wide-character string buffer. 
    
     
    USHORT A 16-bit unsigned integer (range: 0 through 65536 decimal).
     Because a USHORT is unsigned, its first (most significant) bit
     is not reserved for signing.
    
     
    UTIME A 64-bit unsigned integer that represents the number of seconds
     since January 1, 1970, 00:00:00. For example, noon on January 1,
     1970, is represented as 43200. 
    
    UUID A universally unique identifier. This data type exposes the UUID structure
     
    (documented in the Platform SDK), which contains the following:
    
    LONG: Contains the first eight hexadecimal digits of the UUID.
    
     
    SHORT: Contains the first group of four hexadecimal digits of the UUID.
     
    SHORT: Contains the second group of four hexadecimal digits of the UUID.
     
    CHAR[]: An array whose first two bytes specify the third group of four hexadecimal digits, and whose remaining six bytes contain the final 12 hexadecimal digits of the UUID. 
     
    VARIANT An Automation data type (documented in the Platform SDK)
     that contains any other automation data type. 
    
    WCHAR A 16-bit Unicode character. 
    
    wchar_t A 16-bit Unicode character for use with the MIDL compiler.
     
    WORD A 16-bit unsigned integer (range: 0 through 65535 decimal). Because a WORD is unsigned, its first (most significant) bit is not reserved for signing
    cheers!

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> they are the same in 32 bits.

    Yes, but suppose you have a 64 bit chip? Now a signed int could easily be 64 bits. Existing code expecting a 32 bit value would break. A LONG is 32 bits, full stop.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    Now ,thats the kind of answer that would stick to my brain
    for good.

    short definition.
    short example.

    thank you.

    ok with these:
    BYTE An 8-bit block of data.

    CHAR An 8-bit block of data that typically contains a Windows (ANSI) character.

    i think , i am able to utilize them both for char type.

    what is the difference?

    and with this:

    LPSTR A 32-bit pointer to a null-terminated string of 8-bit Windows (ANSI) characters

    I have used it often but im not sure about the pointer terminology

    what happens if u need a 16 bits pointer or 8 bits pointer?

    thx

  4. #4
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801
    >>what happens if u need a 16 bits pointer or 8 bits pointer?<<

    A pointer contains an address not a value. That's why it's 32 bits.
    Last edited by minesweeper; 03-11-2003 at 09:59 AM.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >what happens if u need a 16 bits pointer or 8 bits pointer?
    If it is needed then the implementation will support it. Something like the near, far, and huge keywords that specified between 16 and 32 bit pointer types in Turbo C. If it isn't supported then chances are good that you have no need for it.

    -Prelude
    My best code is written with the delete key.

  6. #6
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    If it is needed then the implementation will support it. Something like the near, far, and huge keywords .


    ok i got it.
    near and far i remember. huge?

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> CHAR An 8-bit block of data that typically contains a Windows (ANSI) character.


    As UNICODE becomes more the norm, a single character would be 16 bits, therefore.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitmasking Problem
    By mike_g in forum C++ Programming
    Replies: 13
    Last Post: 11-07-2007, 11:24 PM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  5. Replies: 1
    Last Post: 07-31-2002, 11:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21