X-Git-Url: https://git.ralfj.de/web.git/blobdiff_plain/ec54d9806fe23aeb10f24ce2647d4e7a1dbd8ece..b1fb7e6b7275d6c6341ecec5aa372f246e863f97:/personal/_posts/2018-07-24-pointers-and-bytes.md diff --git a/personal/_posts/2018-07-24-pointers-and-bytes.md b/personal/_posts/2018-07-24-pointers-and-bytes.md index 636fa40..23371fe 100644 --- a/personal/_posts/2018-07-24-pointers-and-bytes.md +++ b/personal/_posts/2018-07-24-pointers-and-bytes.md @@ -1,6 +1,6 @@ --- title: "Pointers Are Complicated, or: What's in a Byte?" -categories: internship rust +categories: internship rust programming forum: https://internals.rust-lang.org/t/pointers-are-complicated-or-whats-in-a-byte/8045 --- @@ -79,7 +79,7 @@ It does *not* point at an actual element of another object *even if they have th The key point here is that just because `x_ptr` and `&y[0]` point to the same *address*, that does not make them *the same pointer*, i.e., they cannot be used interchangeably: `&y[0]` points to the first element of `y`; `x_ptr` points past the end of `x`. -If we replace `*x_ptr = 23` by `*&y[0] = 0`, we change the meaning of the program, even though the two pointers have been tested for equality. +If we replace `*x_ptr = 23` by `*&y[0] = 23`, we change the meaning of the program, even though the two pointers have been tested for equality. This is worth repeating: