From 15ae719d84c34d6d85332db62e1d512559e66926 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 25 Jul 2018 12:22:13 +0200 Subject: [PATCH] clarify extra-hidden-state-in-memory --- personal/_posts/2018-07-24-pointers-and-bytes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/personal/_posts/2018-07-24-pointers-and-bytes.md b/personal/_posts/2018-07-24-pointers-and-bytes.md index dfd6bd1..5d6b60d 100644 --- a/personal/_posts/2018-07-24-pointers-and-bytes.md +++ b/personal/_posts/2018-07-24-pointers-and-bytes.md @@ -162,7 +162,8 @@ We have to say what the value of `v` is, so we have to find some way to answer t (And this is an entirely separate issue from the problem with multiplication that came up in the last section. We just assume some abstract type `Pointer`.) We cannot represent a byte of a pointer as an element of `0..256`. -Instead, we will remember both the pointer, and which byte of the pointer we got. +Essentially, if we use a naive model of memory, the extra "hidden" part of a pointer (the one that makes it more than just an integer) would be lost whne a pointer is stored to memory and loaded again. +We have to fix this, so we have to extend our notion of a "byte" to accomodate that extra state. So, a byte is now *either* an element of `0..256` ("raw bits"), *or* the n-th byte of some abstract pointer. If we were to implement our memory model in Rust, this might look as follows: {% highlight rust %} -- 2.30.2