authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-27 15:48:31-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-27 15:48:31-04:00
log5de07ab721380c39130a0bd3277a272673e3d644
treeff3ae571b56ac02df30d4ffcc60df4b6848361fc
parentdb0a5e7516fa8cf733fc11d493cadea1efbe5f27

revert hello world examples. macos tests passing


2 files changed, 11 insertions(+), 4 deletions(-)

example/hello_world/hello.zig+6-2
......@@ -1,5 +1,9 @@
11const std = @import("std");
22
3pub fn main() void {
4 std.debug.warn("Hello, world!\n");
3pub fn main() !void {
4 // If this program is run without stdout attached, exit with an error.
5 const stdout_file = try std.io.getStdOut();
6 // If this program encounters pipe failure when printing to stdout, exit
7 // with an error.
8 try stdout_file.write("Hello, world!\n");
59}
example/hello_world/hello_libc.zig+5-2
......@@ -2,9 +2,12 @@ const c = @cImport({
22 // See https://github.com/ziglang/zig/issues/515
33 @cDefine("_NO_CRT_STDIO_INLINE", "1");
44 @cInclude("stdio.h");
5 @cInclude("string.h");
56});
67
7export fn main(argc: c_int, argv: [*]?[*]u8) c_int {
8 _ = c.fprintf(c.stderr, c"Hello, world!\n");
8const msg = c"Hello, world!\n";
9
10export fn main(argc: c_int, argv: **u8) c_int {
11 if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1;
912 return 0;
1013}