top | item 23550406

(no title)

pingyong | 5 years ago

Because usually if I want to store something I put it inside the box? Not sure how that is contrived.

discuss

order

enriquto|5 years ago

When you explain floating point numbers you also put them into boxes? No need for that, you can explain them intrinsically, just like pointers.

Moreover, in practice, it is clear to think that you already have your pointer in your hands (e.g. in a register), no need for your pointer to come from the RAM that it is used refers to. This is an unnecessary recursivity.

pingyong|5 years ago

>When you explain floating point numbers you also put them into boxes?

That makes no sense. If I was explaining floating point numbers with boxes, for whatever reason, I'd put the values inside the boxes, yes. The analogy just doesn't work here, but the analogy for memory makes perfect sense.

>This is an unnecessary recursivity.

No, it's not. Think of a linked list for example. Traversing it makes perfect sense with my analogy: You open the first box, look at the number that's inside, open the box corresponding to that number, look at what number is inside that box, open the next corresponding box, etc. - it all makes immediate and intuitive sense.

If you just start with "open box x" (because x you somehow already know magically because it's already in a register), you haven't really explained much.

Or think of pointers to pointers. With my analogy: Easy! It's just another box which contains the value of the next box. If this concept isn't explained, a pointer to a pointer makes no sense because the pointer value has no corresponding box, hence no address.