开发者

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

开发者 https://www.devze.com 2023-03-17 04:03 出处:网络
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

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?


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.


VB.Net doesn't have an "int", it has an "Integer" type. The Integer type is an alias for System.Int32. So no, this will not change.

0

精彩评论

暂无评论...
验证码 换一张
取 消