From 7365d97709ba77389095c7fe0fb28ef2f14a4b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=C3=A2jinzhongjia?= Date: Mon, 18 Dec 2023 18:31:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- learn/engineering/build-system.md | 2 +- learn/hello-world.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/learn/engineering/build-system.md b/learn/engineering/build-system.md index 64e71199..67e092f3 100644 --- a/learn/engineering/build-system.md +++ b/learn/engineering/build-system.md @@ -470,7 +470,7 @@ pub fn build(b: *std.Build) void { // 添加一个匿名的依赖 // [!code focus] exe.addAnonymousModule("hello", .{ .source_file = .{ .path = "src/hello.txt" } }); // [!code focus] - // 添加到顶级 install step 中作为依赖 + // 添加到顶级 install step 中作为依赖 b.installArtifact(exe); // zig 提供了一个方便的函数允许我们直接运行构建结果 diff --git a/learn/hello-world.md b/learn/hello-world.md index d3ce7837..42694f94 100644 --- a/learn/hello-world.md +++ b/learn/hello-world.md @@ -84,7 +84,7 @@ pub fn main() !void { 它们都是依靠系统调用来实现输出效果,但是这就面临着性能问题,我们知道系统调用会造成内核上下文切换的开销(系统调用的流程:执行系统调用,此时控制权会切换回内核,由内核执行完成进程需要的系统调用函数后再将控制权返回给进程),所以我们如何解决这个问题呢?可以增加一个缓冲区,等到要打印的内容都到一定程度后再一次性全部 `print`,那么此时的解决方式就如下: -```zig +```zig const std = @import("std"); pub fn main() !void {