mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-04-01 05:45:29 +01:00
Merge pull request 'Update type info for StructField type in 082' (#218) from dustdfg/exercises:update_struct_field into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/218
This commit is contained in:
commit
5734e68789
3 changed files with 8 additions and 5 deletions
|
@ -233,6 +233,7 @@ Zig Core Language
|
|||
* [X] Interfaces
|
||||
* [X] Bit manipulation
|
||||
* [X] Working with C
|
||||
* [ ] Opaque types (anyopaque)
|
||||
* [X] Threading
|
||||
* [x] Labeled switch
|
||||
* [x] Vector operations (SIMD)
|
||||
|
|
|
@ -95,13 +95,15 @@ fn printTuple(tuple: anytype) void {
|
|||
// Each 'field' in this loop is one of these:
|
||||
//
|
||||
// pub const StructField = struct {
|
||||
// name: []const u8,
|
||||
// name: [:0]const u8,
|
||||
// type: type,
|
||||
// default_value: anytype,
|
||||
// default_value_ptr: ?*const anyopaque,
|
||||
// is_comptime: bool,
|
||||
// alignment: comptime_int,
|
||||
// };
|
||||
//
|
||||
// Note we will learn about 'anyopaque' type later
|
||||
//
|
||||
// You'll need this builtin:
|
||||
//
|
||||
// @field(lhs: anytype, comptime field_name: []const u8)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- exercises/082_anonymous_structs3.zig 2024-09-07 19:13:58.210327580 +0200
|
||||
+++ answers/082_anonymous_structs3.zig 2024-09-07 19:21:20.972733477 +0200
|
||||
--- exercises/082_anonymous_structs3.zig 2025-03-14 16:41:17.892873287 +0200
|
||||
+++ answers/082_anonymous_structs3.zig 2025-03-14 16:40:56.043829543 +0200
|
||||
@@ -82,14 +82,14 @@
|
||||
// @typeInfo(Circle).@"struct".fields
|
||||
//
|
||||
|
@ -17,7 +17,7 @@
|
|||
// 3. Print the field's name, type, and value.
|
||||
//
|
||||
// Each 'field' in this loop is one of these:
|
||||
@@ -117,9 +117,9 @@
|
||||
@@ -119,9 +119,9 @@
|
||||
//
|
||||
// The first field should print as: "0"(bool):true
|
||||
print("\"{s}\"({any}):{any} ", .{
|
||||
|
|
Loading…
Reference in a new issue