aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-03-07 10:08:07 -0500
committerDave Gauer <dave@ratfactor.com>2021-03-07 10:08:07 -0500
commit0168afd25005b4a3555d2212d2a099cbad344e2b (patch)
tree18d6d4b501e70770f490fcd93a99bd63583b7f5b
parent6a44079c9d9527c2eb29cf9fdcf117d7d5529bb8 (diff)
downloadziglings-0168afd25005b4a3555d2212d2a099cbad344e2b.tar.gz
ziglings-0168afd25005b4a3555d2212d2a099cbad344e2b.tar.bz2
ziglings-0168afd25005b4a3555d2212d2a099cbad344e2b.tar.xz
ziglings-0168afd25005b4a3555d2212d2a099cbad344e2b.zip
"Multi pointers" are now "many pointers"
TypeInfo.Pointer.Size says "many", so there we are!
-rw-r--r--README.md2
-rw-r--r--build.zig2
-rw-r--r--exercises/54_manypointers.zig (renamed from exercises/54_multipointers.zig)10
-rw-r--r--patches/patches/54_manypointers.patch4
-rw-r--r--patches/patches/54_multipointers.patch4
5 files changed, 11 insertions, 11 deletions
diff --git a/README.md b/README.md
index 73793c8..cd4f397 100644
--- a/README.md
+++ b/README.md
@@ -129,7 +129,7 @@ Planned exercises:
* [x] Optionals
* [x] Struct methods
* [x] Slices
-* [x] Multi pointers
+* [x] Many pointers
* [ ] Unions
* [ ] Numeric types (integers, floats)
* [ ] Labelled blocks and loops
diff --git a/build.zig b/build.zig
index 789024b..75fa9a9 100644
--- a/build.zig
+++ b/build.zig
@@ -277,7 +277,7 @@ const exercises = [_]Exercise{
.output = "'all your base are belong to us.' 'for great justice.'",
},
.{
- .main_file = "54_multipointers.zig",
+ .main_file = "54_manypointers.zig",
.output = "Memory is a resource.",
},
};
diff --git a/exercises/54_multipointers.zig b/exercises/54_manypointers.zig
index b6fb1f7..05edd3b 100644
--- a/exercises/54_multipointers.zig
+++ b/exercises/54_manypointers.zig
@@ -18,19 +18,19 @@ pub fn main() void {
//
// const zen12: []const u8 = "...";
//
- // Now let's turn this into a "multi pointer":
- const zen_multiptr: [*]const u8 = zen12;
+ // Now let's turn this into a "many pointer":
+ const zen_manyptr: [*]const u8 = zen12;
- // It's okay to access zen_multiptr just like an array or slice as
+ // It's okay to access zen_manyptr just like an array or slice as
// long as you keep track of the length yourself!
//
// A "string" in Zig is a pointer to an array of const u8 values
// or a slice of const u8 values, into one, as we saw above). So,
- // we could treat a "multi pointer" of const u8 a string as long
+ // we could treat a "many pointer" of const u8 a string as long
// as we can CONVERT IT TO A SLICE. (Hint: we do know the length!)
//
// Please fix this line so the print below statement can print it:
- const zen12_string: []const u8 = zen_multiptr;
+ const zen12_string: []const u8 = zen_manyptr;
// Here's the moment of truth!
std.debug.print("{s}\n", .{zen12_string});
diff --git a/patches/patches/54_manypointers.patch b/patches/patches/54_manypointers.patch
new file mode 100644
index 0000000..82824e8
--- /dev/null
+++ b/patches/patches/54_manypointers.patch
@@ -0,0 +1,4 @@
+33c33
+< const zen12_string: []const u8 = zen_manyptr;
+---
+> const zen12_string: []const u8 = zen_manyptr[0..21];
diff --git a/patches/patches/54_multipointers.patch b/patches/patches/54_multipointers.patch
deleted file mode 100644
index 84d3f14..0000000
--- a/patches/patches/54_multipointers.patch
+++ /dev/null
@@ -1,4 +0,0 @@
-33c33
-< const zen12_string: []const u8 = zen_multiptr;
----
-> const zen12_string: []const u8 = zen_multiptr[0..21];