的sizeof(int)的x64上?sizeof、int

由网友(男痞@)分享简介:当我这样做的sizeof(int)的在我的C#.NET项目中,我得到4.我设置项目类型到x64返回值,那么为什么没有说4而不是8?这是因为我正在设法code?When I do sizeof(int) in my C#.NET project I get a return value of 4. I set the...

当我这样做的sizeof(int)的在我的C#.NET项目中,我得到4.我设置项目类型到x64返回值,那么为什么没有说4而不是8?这是因为我正在设法code?

When I do sizeof(int) in my C#.NET project I get a return value of 4. I set the project type to x64, so why does it say 4 instead of 8? Is this because I'm running managed code?

推荐答案

有各种64位数据模型; Microsoft使用LP64为.NET:双方的长的S和指针是64位(虽然传统的C风格的指针不存在.NET)。与ILP64对比这其中 INT 是也64位。

There are various 64-bit data models; Microsoft uses LP64 for .NET: both longs and pointers are 64-bits (although traditional C-style pointers don't exist .NET). Contrast this with ILP64 where ints are also 64-bits.

因此​​,在所有平台上, INT 是32位和是64位;你可以看到这个名字的基础类型的 System.Int32的和 System.Int64 的。

Thus, on all platforms, int is 32-bits and long is 64-bits; you can see this in the names of the underlying types System.Int32 and System.Int64.

阅读全文

相关推荐

最新文章