Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

print

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

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.

Params

  • fmt: []const u8
  • args

File

debug.zig:323
323
324
325
326
327
328
329
330
331
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;
}