Re:What Makes the Zig Programming Language Unique?
by defen on Thursday October 06, 2022 @02:01AM
(#33104894)
Zig evaluates compile-time expressions using the semantics of the target, does D do that? (I genuinely don't know; not trying to "gotcha")
If I run `zig build-obj` on that on my i9 Mac, compilation fails with an assertion error. If I run `zig build-obj -target arm-freestanding-gnu` instead, it compiles since sizeof(long) is 4 and sizeof(long long) is 8.
[ Parent
| on HN ]
Re:What Makes the Zig Programming Language Unique?
by WalterBright on Thursday October 06, 2022 @03:03AM
(#33105315)
> does D do that?
Yes:
c_longlong square(c_long x) {
static assert(c_longlong.sizeof > c_long.sizeof);
return cast(c_longlong)x * x;
}