What are all my options for the signature of the main
function?
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, {s}!\n", .{"world"});
}
While watching Where is print() in Zig? - Zig NEWS @kristoff mentions that the main
function may return a u8
for the program exit code.
- What is the correct type of a programs exit code?
- How is application portability ensured on the programs exit code? For example on linux it appears to be a
u8
but on windows au32
? - Does returning
!void
automatically use exit code 1 on error?