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.

appendCcExe

LibCInstallation.appendCcExe
fn appendCcExe(
    args: *std.array_list.Managed([]const u8),
    skip_cc_env_var: bool,
    environ_map: *const Environ.Map,
) !void

File

lib/std/zig/LibCInstallation.zig:678

Code

fn appendCcExe(
    args: *std.array_list.Managed([]const u8),
    skip_cc_env_var: bool,
    environ_map: *const Environ.Map,
) !void {
    const default_cc_exe = if (is_windows) "cc.exe" else "cc";
    try args.ensureUnusedCapacity(1);
    if (skip_cc_env_var) {
        args.appendAssumeCapacity(default_cc_exe);
        return;
    }
    const cc_env_var = std.zig.EnvVar.CC.get(environ_map) orelse {
        args.appendAssumeCapacity(default_cc_exe);
        return;
    };
    // Respect space-separated flags to the C compiler.
    var it = std.mem.tokenizeScalar(u8, cc_env_var, ' ');
    while (it.next()) |arg| {
        try args.append(arg);
    }
}