| 1 | #update=initial version |
| 2 | #file=main.zig |
| 3 | const S = extern struct { x: u8, y: u8 }; |
| 4 | pub fn main() !void { |
| 5 | const val: S = .{ .x = 100, .y = 200 }; |
| 6 | try foo(&val); |
| 7 | } |
| 8 | fn 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 | } |
| 15 | const std = @import("std"); |
| 16 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 17 | #expect_stdout="100 200\n" |
| 18 | |
| 19 | #update=change struct layout |
| 20 | #file=main.zig |
| 21 | const S = extern struct { x: u32, y: u32 }; |
| 22 | pub fn main() !void { |
| 23 | const val: S = .{ .x = 100, .y = 200 }; |
| 24 | try foo(&val); |
| 25 | } |
| 26 | fn 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 | } |
| 33 | const std = @import("std"); |
| 34 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 35 | #expect_stdout="100 200\n" |
| 36 | |
| 37 | #update=change values |
| 38 | #file=main.zig |
| 39 | const S = extern struct { x: u32, y: u32 }; |
| 40 | pub fn main() !void { |
| 41 | const val: S = .{ .x = 1234, .y = 5678 }; |
| 42 | try foo(&val); |
| 43 | } |
| 44 | fn 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 | } |
| 51 | const std = @import("std"); |
| 52 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 53 | #expect_stdout="1234 5678\n" |