Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

print

Writes to stderr, ignoring errors.

This is a low-level debugging primitive that bypasses the Io interface, writing directly to stderr using the most basic syscalls available. This function does not switch threads, switch stacks, or suspend.

Uses a 64-byte buffer for formatted printing which is flushed before this function returns.

Alternatively, use the higher-level std.log or Io.lockStderr to integrate with the application's chosen Io implementation.

debug.print
pub fn print(comptime fmt: []const u8, args: anytype) void

File

lib/std/debug.zig:315

Code

pub fn print(comptime fmt: []const u8, args: anytype) void {
    const io = std.Options.debug_io;
    const prev = io.swapCancelProtection(.blocked);
    defer _ = io.swapCancelProtection(prev);
    var buffer: [64]u8 = undefined;
    const stderr = lockStderr(&buffer);
    defer unlockStderr();
    stderr.file_writer.interface.print(fmt, args) catch return;
}