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.

transOffsetof

Translator.transOffsetof
fn transOffsetof(t: *Translator, scope: *Scope, arg: Node.Index) TransError!ZigNode

File

lib/compiler/translate-c/Translator.zig:3304

Code

fn transOffsetof(t: *Translator, scope: *Scope, arg: Node.Index) TransError!ZigNode {
    // Translate __builtin_offsetof(T, designator) as
    // @intFromPtr(&(@as(*allowzero T, @ptrFromInt(0)).designator))
    const member = try t.transMemberDesignator(scope, arg);
    const address = try ZigTag.address_of.create(t.arena, member);
    return ZigTag.int_from_ptr.create(t.arena, address);
}