| ... | @@ -9889,12 +9889,13 @@ The result is 3</code></pre> | ... | @@ -9889,12 +9889,13 @@ The result is 3</code></pre> |
| 9889 | const std = @import("std"); | 9889 | const std = @import("std"); |
| 9890 | | 9890 | |
| 9891 | pub fn main() !void { | 9891 | pub fn main() !void { |
| 9892 | // TODO a better default allocator that isn't as wasteful! | 9892 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; |
| 9893 | const args = try std.process.argsAlloc(std.heap.page_allocator); | 9893 | const gpa = &general_purpose_allocator.allocator; |
| 9894 | defer std.process.argsFree(std.heap.page_allocator, args); | 9894 | const args = try std.process.argsAlloc(gpa); |
| | 9895 | defer std.process.argsFree(gpa, args); |
| 9895 | | 9896 | |
| 9896 | for (args) |arg, i| { | 9897 | for (args) |arg, i| { |
| 9897 | std.debug.print("{}: {}\n", .{i, arg}); | 9898 | std.debug.print("{}: {}\n", .{ i, arg }); |
| 9898 | } | 9899 | } |
| 9899 | } | 9900 | } |
| 9900 | {#code_end#} | 9901 | {#code_end#} |