Zigでnull-terminatedじゃないと怒られた
code: main.zig
var con_out: *uefi.protocols.SimpleTextOutputProtocol = undefined;
fn puts(msg: []const u8) void {
for (msg) |c| {
_ = con_out.outputString(&_u16{ c, 0 }); }
}
code:console
./src/main.zig:10:41: error: expected type '*:0const u16', found '*2u16' _ = con_out.outputString(&_u16{ c, 0 }); ^
./src/main.zig:10:41: note: destination pointer requires a terminating '0' sentinel
_ = con_out.outputString(&_u16{ c, 0 }); ^
code: answer.txt
You can do _:0const u16 to let the compiler append the sentinel Or you can slice the array and have a runtime check with array0..len:0