3 ms·
I don't understand. Rust has memory safety as a core design principle. Zig has manual memory allocation like C.
by CyberDildonics 8y ago
I don't understand. Rust has memory safety as a core design principle. Zig has manual memory allocation like C.
- tiehuis 8y agoZig is memory-safe if you keep runtime checks enabled (e.g. with debug or release-safe optimization levels) but it does not have the compile-time guarantees of Rust. I don't think the parent comment is a fair reflection. That being said, some other potentially interesting safety aspects that are present (or are being explored) to give some idea of the target audience: - compile-time alignment checks [1] - maximum compile-time stack usage/bounding [2] I would expect safety at the end of the day in Zig will be more similar to modern C++ and its smart pointers, alongside (optional) runtime checks, than a full lifetime system. Will have to see what the future holds. [1] https://ziglang.org/documentation/master/#Alignment https://ziglang.org/documentation/master/#Alignment [2] https://github.com/ziglang/zig/issues/1006 https://github.com/ziglang/zig/issues/1006