mirror of
https://github.com/ziglang/zig.git
synced 2024-12-17 16:50:13 +00:00
revert hello world examples. macos tests passing
This commit is contained in:
parent
db0a5e7516
commit
5de07ab721
@ -1,5 +1,9 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn main() void {
|
||||
std.debug.warn("Hello, world!\n");
|
||||
pub fn main() !void {
|
||||
// If this program is run without stdout attached, exit with an error.
|
||||
const stdout_file = try std.io.getStdOut();
|
||||
// If this program encounters pipe failure when printing to stdout, exit
|
||||
// with an error.
|
||||
try stdout_file.write("Hello, world!\n");
|
||||
}
|
||||
|
@ -2,9 +2,12 @@ const c = @cImport({
|
||||
// See https://github.com/ziglang/zig/issues/515
|
||||
@cDefine("_NO_CRT_STDIO_INLINE", "1");
|
||||
@cInclude("stdio.h");
|
||||
@cInclude("string.h");
|
||||
});
|
||||
|
||||
export fn main(argc: c_int, argv: [*]?[*]u8) c_int {
|
||||
_ = c.fprintf(c.stderr, c"Hello, world!\n");
|
||||
const msg = c"Hello, world!\n";
|
||||
|
||||
export fn main(argc: c_int, argv: **u8) c_int {
|
||||
if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user