Thread: Microsoft .NET 2003 Question

  1. #1
    Bioport Productions
    Join Date
    Oct 2005

    Microsoft .NET 2003 Question

    I've looked and looked for documentation about the compiler but I can't find anything. I'm wondering how many bytes an integer is in the Win32 platform compiler. It's 2 or 4 I know but I need to know exactly. Seems logical that int is 2 and long is 4 because its a 32 bit compiler, but I don't know. Anyone know for sure?
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:

  2. #2
    Registered User
    Join Date
    Aug 2005
    "Integer variables are stored as signed 32-bit (4-byte) integers ranging in value from -2,147,483,648 through 2,147,483,647.

    The Integer data type provides optimal performance on a 32-bit processor, as the smaller integral types are slower to load and store from and to memory.

    You can convert the Integer data type to Long, Single, Double, or Decimal without encountering a System.OverflowException error.

    Caution If you are interfacing with components written in Visual Basic version 6.0, for example Automation or COM objects, keep in mind that Integer has a different data width (16 bits) in Visual Basic 6.0. If you are passing a 16-bit argument to such a component, declare it as Short instead of Integer in Visual Basic .NET.
    Appending the literal type character I to a literal forces it to the Integer data type. Appending the identifier type character % to any identifier forces it to Integer.

    The equivalent .NET data type is System.Int32."

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001

    Lightbulb <climits>

    FYI - The <climits> header contains a bunch of constants, such as INT_MAX, UINT_MAX, ULONG_MAX, etc. These constants represent the maximum value that each type can hold.

    You can write a little program to display the values, or to calculate the number of bits / bytes for each type on your particular platform.

    You might be able to use the sizeof() macro, but I don't trust it because the C++ standard does NOT define a byte as 8 bits! The standard says something like "A byte is at least big-enough to hold a type char".
    Last edited by DougDbug; 10-06-2005 at 05:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual Studio .Net Question
    By loko in forum C++ Programming
    Replies: 7
    Last Post: 09-05-2005, 07:54 PM
  2. Problems installing GLUT in .NET 2003
    By Kaminaga in forum Game Programming
    Replies: 4
    Last Post: 08-18-2005, 05:33 PM
  3. Replies: 4
    Last Post: 11-11-2003, 04:22 AM
  4. compile c programs with visual studio .net 2003
    By kashifk in forum C Programming
    Replies: 4
    Last Post: 10-11-2003, 09:37 PM
  5. VS .NET & XP Pro Question
    By hk_mp5kpdw in forum A Brief History of
    Replies: 4
    Last Post: 01-08-2003, 01:07 PM