4 ms·
Interesting article but I disagree with conclusion. Namely these two do not compute: > if you choose the C-way manual memory management, you will make program
by Ygg2 3y ago
Interesting article but I disagree with conclusion.
Namely these two do not compute:
> if you choose the C-way manual memory management, you will make programmers debugging their code for long hours with the hope that -fsanitize=address would show something meaningful
> Zig can still be used in large systems projects like web browsers, interpreters, and operating system kernels – nobody wants these things to freeze unexpectedly.
But Zig isn't meaningfully safer than C. So you still get to debug code for long hours hoping you'll spot the error.
- em-bee 3y agoZig isn't meaningfully safer than C it's not? why would anyone bother using it then?
- Ygg2 3y agoBecause it's not Rust/C. And it does have some nifty features like tagged unions and comptime. Here is Zig UB in a nutshell const std = @import("std"); pub fn main() !void { const warning1 = try powerLevel(9000); const warning2 = try powerLevel(10); std.debug.print("{s}\n", .{warning1}); std.debug.print("{s}\n", .{warning2}); } fn powerLevel(over: i32) ![]u8 { var buf: [20]u8 = undefined; return std.fmt.bufPrint(&buf, "over {d}!!!", .{over}); }
- xedrac 3y agoI haven't my used Zig much, but I suspect that in practice Zig is much safer, even if only because it's more expressive.