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?
When I do sizeof(int) in my C#.NET project I get a return value of
Share
There are various 64-bit data models; Microsoft uses LP64 for .NET: both longs and pointers are 64-bits (although C-style pointers can only be used in C# in
unsafecontexts or as aIntPtrvalue which cannot be used for pointer-arithmetic). Contrast this with ILP64 where ints are also 64-bits.Thus, on all platforms,
intis 32-bits andlongis 64-bits; you can see this in the names of the underlying typesSystem.Int32andSystem.Int64.