authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-15 08:51:56+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-07-15 08:51:56+02:00
logd3cd0b27145fb9d295078a6883f9714769cb482b
treeddf7e7dc4fe9d8791f966b1db0a079697212997d
parent294db62d926ef82f2beb86e7e5ddf8d69092864a
parentd90646d8fbd8658120c39bc2690088c0efa21157
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #24448 from matklad/matklad/inline

langref: make example more interesting.

2 files changed, 7 insertions(+), 5 deletions(-)

doc/langref/defer_unwind.zig+2-3
......@@ -1,8 +1,7 @@
11const std = @import("std");
2const expect = std.testing.expect;
32const print = std.debug.print;
43
5test "defer unwinding" {
4pub fn main() void {
65 print("\n", .{});
76
87 defer {
......@@ -19,4 +18,4 @@ test "defer unwinding" {
1918 }
2019}
2120
22// test
21// exe=succeed
doc/langref/inline_call.zig+5-2
......@@ -1,11 +1,14 @@
1test "inline function call" {
1const std = @import("std");
2
3pub fn main() void {
24 if (foo(1200, 34) != 1234) {
35 @compileError("bad");
46 }
57}
68
79inline fn foo(a: i32, b: i32) i32 {
10 std.debug.print("runtime a = {} b = {}", .{ a, b });
811 return a + b;
912}
1013
11// test
14// exe=succeed