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.
pubinlinefnobject_size(ptr: ?*constanyopaque, ty: c_int) usize {
_ = ptr;
// clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
// If it is not possible to determine which objects ptr points to at compile time,
// object_size should return (size_t) -1 for type 0 or 1 and (size_t) 0
// for type 2 or 3.
if (ty == 0orty == 1) return@as(usize, @bitCast(-@as(isize, 1)));
if (ty == 2orty == 3) return0;
unreachable;
}