Possible Duplicate:
Assuming 32bit ints
So I read somewhere that int equals int32 in c#. Is it true also on 64-bit machines? Should I use int32 just to make sure no one at microsoft decides to change the size of int?
Possible Duplicate:
Assuming 32bit ints
So I read somewhere that int equals int32 in c#. Is it true also on 64-bit machines? Should I use int32 just to make sure no one at microsoft decides to change the size of int?
int
is an alias for Int32
long
is an alias for Int64
Their sizes will not change, at all, just use whichever one you need to use.
The use of them in your code is in no way related to 32bit and 64bit machines
EDIT: In reference to the comments about Thread Safety. Here is a good question and answers that detail any issues you need to be aware of. Under C# is Int64 use on a 32 bit processor dangerous
On both 32-bit and 64-bit machines:
long
is 64-bit, it's a synonym for System.Int64
.int
is 32-bit, it's a synonym for System.Int32
.You don't need to worry. An int
is an Int32
is a 32-bit signed integer, and that won't change, regardless of the platform that you're using.
See the Microsoft C# spec (section 1.3), the ECMA C# spec (section 8.2.1) and the ECMA CLI spec (section 8.2.2).
I used Int32 in my first year with .NET (then 1.0). Mostly did it for cross-language readability, as Int32 looks the same in VB as in C#. Looking back, I see this entire concern was silly. Use native types and don't sweat it.