mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-11-09 11:40:46 -05:00
check for dev1650 and some minor polish
This commit is contained in:
parent
b2de68869e
commit
1d10a062e2
6 changed files with 12 additions and 9 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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});
|
||||
|
|
|
@ -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,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);
|
||||
|
|
Loading…
Reference in a new issue