Search code examples
vb.netintegeraliasint32

Is it safe to assume an Integer will always be 32 bits in VB.Net?


Related:

Is it safe to assume an int will always be 32 bits in C#?

The linked question asks whether it is "safe to assume that an int will always be 32 bits in C#". The accepted answer states that "the C# specification rigidly defines that int is an alias for System.Int32 with exactly 32 bits".

My question is this: does this hold true for VB.Net's Integer? Is it safe to assume that Integer will always be an alias for int32?


Solution

  • Yes.
    The Integer type will never change.

    The spec (7.3 Primitive Types) says:

    The integral value types Byte (1-byte unsigned integer), Short (2-byte signed integer), Integer (4-byte signed integer), and Long (8-byte signed integer). These types map to System.Byte, System.Int16, System.Int32, and System.Int64, respectively. The default value of an integral type is equivalent to the literal 0.