logoalt Hacker News

nvme0n1p1today at 7:30 PM1 replyview on HN

What's your source for this? Comptime Zig code can do pointer casts and whatnot, all emulated as if run on the target bitness/endianness/etc. And any operations that are undefined on the target platform result in a compile error. I've never had an issue cross-compiling.


Replies

weinzierltoday at 8:57 PM

Endianness and pointer casts are the mechanical part and I would expect Zig to emulate them correctly.

Other parts, like floats are harder. This is where a difference shows. Rust is like: "Sorry, since we cannot uphold our guarantees, no transcendentals for you at comptime ", whereas Zig is chill about that and let you have your transcendentals even if results may differ between comptime and runtime. Different mindsets.

show 1 reply