| author | |
| committer | |
| log | 96bb1137c23688f01283be24ac9b52e1440afded |
| tree | 51a20754b41561cec76344d92f6392f746578a86 |
| parent | d045eb7a4af758e3483e5e8fd9bdbe725095fdec |
The rule: `pub fn main` owns file descriptors 0, 1, and 2. If you didn't
write `pub fn main()` it is, in general, not your business to print to
stderr.2 files changed, 4 insertions(+), 4 deletions(-)
doc/langref/defer_unwind.zig+2-2| ... | @@ -2,7 +2,7 @@ const std = @import("std"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const expect = std.testing.expect; | 2 | const expect = std.testing.expect; |
| 3 | const print = std.debug.print; | 3 | const print = std.debug.print; |
| 4 | 4 | ||
| 5 | test "defer unwinding" { | 5 | pub fn main() void { |
| 6 | print("\n", .{}); | 6 | print("\n", .{}); |
| 7 | 7 | ||
| 8 | defer { | 8 | defer { |
| ... | @@ -19,4 +19,4 @@ test "defer unwinding" { | ... | @@ -19,4 +19,4 @@ test "defer unwinding" { |
| 19 | } | 19 | } |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | // test | 22 | // exe=succeed |
doc/langref/inline_call.zig+2-2| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | test "inline function call" { | 3 | pub fn main() void { |
| 4 | if (foo(1200, 34) != 1234) { | 4 | if (foo(1200, 34) != 1234) { |
| 5 | @compileError("bad"); | 5 | @compileError("bad"); |
| 6 | } | 6 | } |
| ... | @@ -11,4 +11,4 @@ inline fn foo(a: i32, b: i32) i32 { | ... | @@ -11,4 +11,4 @@ inline fn foo(a: i32, b: i32) i32 { |
| 11 | return a + b; | 11 | return a + b; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // test | 14 | // exe=succeed |