On Saturday, 17 October 2020 at 15:03:29 UTC, Dennis wrote:
If you want to exactly match the original C code's semantics, I suggest translating (unsigned) long with c_long or c_ulong. You can import them here:
```
import core.stdc.config: c_long, c_ulong;
```

Then you could add this:
```
static assert(c_long.sizeof == size_t.sizeof);
```

This will fail on Windows 64 bit, where C longs are 32-bit and pointers 64-bit.

That is useful information in general, I did not know about core.stdc.config and it is useful in future projects!

But for my project the C works at 64 bits except on Windows for the reason you gave. So by translating long in C to long in D it loses 32 bits but gains 64 bits on Windows. This is what I want.

Reply via email to