zig/test/cases/optional_payload.1.zig

18 lines
235 B
Zig

pub fn main() void {
var x: u32 = undefined;
const maybe_x = byPtr(&x);
assert(maybe_x == null);
}
fn byPtr(x: *u32) ?*u32 {
_ = x;
return null;
}
fn assert(ok: bool) void {
if (!ok) unreachable;
}
// run
//