News for hackers. Stuff that matters.
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")

   const std = @import("std");

   export fn square(x: c_long) c_longlong {
       comptime std.debug.assert(@sizeOf(c_longlong) > @sizeOf(c_long));
       return @as(c_longlong, x) * x;
   }
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.
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;
    }