Last active
February 17, 2024 09:44
-
-
Save tshak/dda765ec517dab7f58b77d85e2886cf4 to your computer and use it in GitHub Desktop.
Zig ArrayList Not Safe :(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub fn main() !void { | |
var list = std.ArrayList(u21).init(std.heap.page_allocator); | |
try list.append(1); | |
list.deinit(); | |
// Seg fault :( | |
std.debug.print("{}", .{list.items[0]}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment