RSSAmplifier

openmymind.net · Sep 20, 2025

Is Zig's New Writer Unsafe?

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

If we wanted to write a function that takes one of Zig's new *std.Io.Reader and write it to stdout, we might start with something like: fn output(r: *std.Io.Reader) !void { const stdout = std.fs.File.stdout(); var buffer: [???]u8 = undefined; var writer = stdout.writer(&buffer); _ = try r.stream(&writer.interface, .unlimited); try writer.interface.flush(); } But what should the size of buffer be?…

Read on openmymind.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.