diff options
author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2023-04-05 16:30:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 16:30:51 +0200 |
commit | 8bf719e5e22dacccf68916455b7634b7b04453a0 (patch) | |
tree | adee3b2436e2885f28e7d2342eedde0e0e9a160c /exercises/040_pointers2.zig | |
parent | b75a76d072f9cc5e0989062a0f45f13ce576d3b6 (diff) | |
parent | 14ad753001ee86b13e285b431843343815fd35ee (diff) |
Merge pull request #216 from chrboesch/i215
improving the explanation
Diffstat (limited to 'exercises/040_pointers2.zig')
-rw-r--r-- | exercises/040_pointers2.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/exercises/040_pointers2.zig b/exercises/040_pointers2.zig index 43dd2c3..a4852f6 100644 --- a/exercises/040_pointers2.zig +++ b/exercises/040_pointers2.zig @@ -12,10 +12,12 @@ // &foo is of type "*u8" // &bar is of type "*const u8" // -// You can always make a constant pointer to a variable, but you cannot -// make a variable pointer to a constant. This sounds like a logic puzzle, -// but it just means that once data is declared immutable, you can't -// coerce it to a mutable type. It's a safety thing (to prevent mistakes). +// You can always make a const pointer to a mutable value (var), but +// you cannot make a var pointer to an immutable value (const). +// This sounds like a logic puzzle, but it just means that once data +// is declared immutable, you can't coerce it to a mutable type. +// Think of mutable data as being volatile or even dangerous. Zig +// always lets you be "more safe" and never "less safe." // const std = @import("std"); |