master
1#target=x86_64-linux-selfhosted
2#target=x86_64-windows-selfhosted
3#target=x86_64-linux-cbe
4#target=x86_64-windows-cbe
5#target=wasm32-wasi-selfhosted
6#update=initial version
7#file=main.zig
8const S = extern struct { x: u8, y: u8 };
9pub fn main() !void {
10 const val: S = .{ .x = 100, .y = 200 };
11 try foo(&val);
12}
13fn foo(val: *const S) !void {
14 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
15 try stdout_writer.interface.print(
16 "{d} {d}\n",
17 .{ val.x, val.y },
18 );
19}
20const std = @import("std");
21#expect_stdout="100 200\n"
22
23#update=change struct layout
24#file=main.zig
25const S = extern struct { x: u32, y: u32 };
26pub fn main() !void {
27 const val: S = .{ .x = 100, .y = 200 };
28 try foo(&val);
29}
30fn foo(val: *const S) !void {
31 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
32 try stdout_writer.interface.print(
33 "{d} {d}\n",
34 .{ val.x, val.y },
35 );
36}
37const std = @import("std");
38#expect_stdout="100 200\n"
39
40#update=change values
41#file=main.zig
42const S = extern struct { x: u32, y: u32 };
43pub fn main() !void {
44 const val: S = .{ .x = 1234, .y = 5678 };
45 try foo(&val);
46}
47fn foo(val: *const S) !void {
48 var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
49 try stdout_writer.interface.print(
50 "{d} {d}\n",
51 .{ val.x, val.y },
52 );
53}
54const std = @import("std");
55#expect_stdout="1234 5678\n"