mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-28 19:00:52 +08:00
49 lines
946 B
Plaintext
49 lines
946 B
Plaintext
#exe {
|
|
-Mroot=main.zig
|
|
#}
|
|
|
|
#write main.zig {
|
|
pub fn main() !void {
|
|
try foo();
|
|
}
|
|
fn foo() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
|
|
}
|
|
const std = @import("std");
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#}
|
|
#update "non-inline version"
|
|
#check stdout {
|
|
Hello, World!
|
|
#}
|
|
|
|
#write main.zig {
|
|
pub fn main() !void {
|
|
try foo();
|
|
}
|
|
inline fn foo() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
|
|
}
|
|
const std = @import("std");
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#}
|
|
#update "make function inline"
|
|
#check stdout {
|
|
Hello, World!
|
|
#}
|
|
|
|
#write main.zig {
|
|
pub fn main() !void {
|
|
try foo();
|
|
}
|
|
inline fn foo() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, `inline` World!\n");
|
|
}
|
|
const std = @import("std");
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#}
|
|
#update "change string"
|
|
#check stdout {
|
|
Hello, `inline` World!
|
|
#}
|