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