On Tuesday, 29 August 2017 at 01:34:40 UTC, Johnson Jones wrote:
import core.stdc.config;
pragma(msg, c_long.sizeof);
prints 4UL
both on x64 and x86
and and C:
void foo()
{
int dummy;
switch (dummy) {
case sizeof(long) :
case sizeof(long) :
break;
}
}
produces 4 on both x86 and x64. So, I'm not sure how you are
getting 8.
It's because you're on Windows. There, long/ulong are 4 bytes in
both 32- and 64-bit. On Linux/Mac/*BSD, they're 4 in 32-bit and 8
in 64-bit. This is why we have c_long and c_ulong, to hide those
differences.