On Saturday, 17 October 2020 at 14:50:47 UTC, NonNull wrote:
I have inherited an open source C project that assumes that the
size of a long and the size of a pointer are the same, and I
have translated it into very similar D just like
https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/
D has the size of long fixed at 64 bits, so a pointer now has
to be 64 bits.
No it's wrong. A pointer always has the size of a general purpose
register.
So I want to put something into the source to ensure an attempt
to make a 32 bit build fails. What is the best way to do this?
anyway you have several options:
---
version(X86)
static assert (false, "not for i386");
---
or
---
static assert (size_t.sizeof != 4, "blablalala");
---