2 ms·
Zig isn't meaningfully safer than C it's not? why would anyone bother using it then?
by em-bee 3y ago
Zig 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}); }