On Wednesday, 6 December 2017 at 04:27:01 UTC, Mike Parker wrote:
On Wednesday, 6 December 2017 at 04:14:35 UTC, Arun Chandrasekaran wrote:
In D, long and ulong are always 8 bytes. This lines up with most 64-bit systems under the version(Posix) umbrella, where long and unsigned long are also 8 bytes. However, they are 4 bytes on 32-bit architectures. Moreover, they’re always 4 bytes on Windows, even on a 64-bit architecture.

Why is this? How are we expected to write cross platform code with long/ulong? What are the alternatives?

It's right there in the blog post:

import core.stdc.config : c_ulong, clong;

Or was the paragraph ambiguous for you? long and ulong are always 8 bytes in D. It's the C types that vary across platforms. I've updated the text as Joakim suggested for clarity.

Reply via email to