sizeof(int) on x64?

前端 未结 7 1536
眼角桃花
眼角桃花 2020-11-28 13:31

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 r

相关标签:
7条回答
  • 2020-11-28 14:01

    You may be thinking of an int pointer or System.IntPtr. This would be 8 bytes on an x64 and 4 bytes on an x86. The size of a pointer shows that you have 64-bit addresses for your memory. (System.IntPtr.Size == 8 on x64)

    The meaning of int is still 4 bytes whether you are on an x86 or an x64. That is to say that an int will always correspond to System.Int32.

    0 讨论(0)
提交回复
热议问题