@inlineCall

@inlineCall

@inlineCall(function: X, args: ...) Y

This calls a function, in the same way that invoking an expression with parentheses does:

test.zig

const assert = @import("std").debug.assert;

test "inline function call" {
    assert(@inlineCall(add, 3, 9) == 12);
}

fn add(a: i32, b: i32) i32 { return a + b; }
``` ```
$ zig test test.zig
1/1 test "inline function call"...OK
All tests passed.

Unlike a normal function call, however, @inlineCall guarantees that the call will be inlined. If the call cannot be inlined, a compile error is emitted.

See also:

  • @noInlineCall