int on a 64-Bit machine
If I declare a variable of type int in C# it will normally map to System.Int32. If I run the same application on a 64-Bit machine will it then map to System.Int64?
In C#, unlike C++, ints and longs are predefined as being 32 and 64 bit respectively. This is the same on any platform, whether 32 or 64 bit. As long as you aren't using any unmanaged components, you really don't need to worry.
However, I still use Int16/Int32/Int64, etc. instead of int ... I don't believe that int will map to Int32 indefinitely, so I lean towards the side of extra caution.
Josh
int will be always 32-bits. (see 11.11.5 Integral types )
To get a system-dependant 32/64 bits use "native int" (CIL) exposed in class libary as System.IntPtr. For more information read 8.2.2 Built-in Types
The only reason I can see you wanting 64 bits in a managed situation is if you were trying to access over the 4 GB addressable memory limit (for which there are collections such as BigArray), or if you were interfacing with unmanaged code. Otherwise you simply use longs or Int64s in your code.
Josh
Here is some useful information from one of the 64 bit CLR team member's blogs:
http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx
Hope this helps,
Josh Lindenmuth
Thanks,
Eugene