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.
fnmangleWeakGlobalName(t: *Translator, want_name: []constu8) Error![]constu8 {
varcur_name = want_name;
if (!t.weak_global_names.contains(want_name)) {
// This type wasn't noticed by the name detection pass, so nothing has been treating this as
// a weak global name. We must mangle it to avoid conflicts with locals.
cur_name = trystd.fmt.allocPrint(t.arena, "{s}_{d}", .{ want_name, t.getMangle() });
}
while (t.global_names.contains(cur_name)) {
cur_name = trystd.fmt.allocPrint(t.arena, "{s}_{d}", .{ want_name, t.getMangle() });
}
returncur_name;
}