Просмотр исходного кода

check for dev1650 and some minor polish

Chris Boesch 2 лет назад
Родитель
Сommit
1d10a062e2
6 измененных файлов с 12 добавлено и 9 удалено
  1. 4 2
      README.md
  2. 1 1
      build.zig
  3. 3 3
      exercises/026_hello2.zig
  4. 2 2
      exercises/093_hello_c.zig
  5. 1 0
      exercises/094_c_math.zig
  6. 1 1
      patches/patches/093_hello_c.patch

+ 4 - 2
README.md

@@ -27,6 +27,7 @@ or a "systems" level language such as C.
 Each exercise is self-contained and self-explained. However, you're encouraged
 to also check out these Zig language resources for more detail:
 
+* https://ziglang.org/learn/
 * https://ziglearn.org/
 * https://ziglang.org/documentation/master/
 
@@ -41,7 +42,7 @@ Verify the installation and build number of `zig` like so:
 
 ```bash
 $ zig version
-0.11.0-dev.1638+xxxxxxxxx
+0.11.0-dev.1650+xxxxxxxxx
 ```
 
 Clone this repository with Git:
@@ -81,7 +82,7 @@ about input:
 
 ### Version Changes
 
-Version-0.11.0-dev.1638+xxxxxxxxx
+Version-0.11.0-dev.1650+xxxxxxxxx
 * *2023-02-12* zig 0.11.0-dev.1638 - changes in `std.Build` cache_root now returns a directory struct
 * *2023-02-04* zig 0.11.0-dev.1568 - changes in `std.Build` (combine `std.build` and `std.build.Builder` into `std.Build`)
 * *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` (now returns a tuple) and `@typeInfo`; temporary disabled async functionality
@@ -166,6 +167,7 @@ Core Language
 * [ ] Async <--- IN PROGRESS!
 * [X] Interfaces
 * [X] Working with C
+* [ ] String formating
 
 ## Contributing
 

+ 1 - 1
build.zig

@@ -8,7 +8,7 @@ const print = std.debug.print;
 // When changing this version, be sure to also update README.md in two places:
 //     1) Getting Started
 //     2) Version Changes
-const needed_version = std.SemanticVersion.parse("0.11.0-dev.1638") catch unreachable;
+const needed_version = std.SemanticVersion.parse("0.11.0-dev.1650") catch unreachable;
 
 const Exercise = struct {
     /// main_file must have the format key_name.zig.

+ 3 - 3
exercises/026_hello2.zig

@@ -7,9 +7,9 @@ const std = @import("std");
 
 // Take note that this main() definition now returns "!void" rather
 // than just "void". Since there's no specific error type, this means
-// that Zig will infer the error type. This is appropriate in the
-// case of main(), but can make a function harder (function pointers)
-// or even impossible to work with (recursion) in some situations.
+// that Zig will infer the error type. This is appropriate in the case
+// of main(), but can make a function harder (function pointers) or
+// even impossible to work with (recursion) in some situations.
 //
 // You can find more information at:
 // https://ziglang.org/documentation/master/#Inferred-Error-Sets

+ 2 - 2
exercises/093_hello_c.zig

@@ -53,8 +53,8 @@ pub fn main() void {
     // specify a file descriptor i.e. 2 for error console.
     //
     // In  this exercise we use 'write' to output 17 chars,
-    // but something is missing...
-    const c_res = ???write(2, "Hello C from Zig!", 17);
+    // but something is still missing...
+    const c_res = write(2, "Hello C from Zig!", 17);
 
     // let's see what the result from C is:
     std.debug.print(" - C result ist {d} chars written.\n", .{c_res});

+ 1 - 0
exercises/094_c_math.zig

@@ -29,5 +29,6 @@ pub fn main() !void {
     // Here we call the C function 'fmod' to get our normalized angel.
     const result = c.fmod(angel, circle);
 
+    // We use formatters for the desired precision and to truncate the decimal places
     std.debug.print("The normalized angle of {d: >3.1} degrees is {d: >3.1} degrees.\n", .{ angel, result });
 }

+ 1 - 1
patches/patches/093_hello_c.patch

@@ -1,4 +1,4 @@
 57c57
-<     const c_res = ???write(2, "Hello C from Zig!", 17);
+<     const c_res = write(2, "Hello C from Zig!", 17);
 ---
 >     const c_res = c.write(2, "Hello C from Zig!", 17);