Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Just for future reference, the devrant category is for rants about devRant itself.
-
@iiii with a specific interpretation that actually hides a metric ton of complexity that the OS and underlying hardware keep from you
I'm not disagreeing, but pretty much all data on a digital computer is just unsigned numbers -
iiii90854y@RememberMe as far as I've heard about pointers from different people, thinking of them as just numbers makes them much less obscure and much more understandable overall. They become much less arcane
-
@iiii but numbers lie
Numbers have properties that pointers don't (like addition and every number being same-ish. Pointer accesses can very wildly in access time and bandwidth).
We were taught pointers as abstract arrows that happen to be represented by unsigned numbers in the von Neumann big row of memory abstraction that CPUs follow. I think that explanation is clearer because it decouples what a pointer is from how it's implemented. It's an indirection, just an arrow to something, almost like what a pronoun does in a sentence. Because computers represent everything with numbers, the arrow is also a number. Because von Neumann abstraction needs a linear contiguous memory space, the pointer-numbers occupy a linear contiguous memory space.
Basically, the same reason why explaining recursion via call stacks is bad. Recursion has nothing to do with stacks at all, it's just the ability of something to refer to itself, usually by using its name as an indirection (hint hint abstract pointer) though there are technically other ways of doing it. It's just that ordinary function call on CPUs happens via call stacks so that's the perspective you generally learn. Important because there's no reason why recursion can't have other implementations (conversion to iteration for primitive recursion, unrolling, spatial/parallel hardware or concurrent processes etc.).
Related Rants
Pointer in C++ / C was the most anal-ystic concept I have ever come across.
devrant
c
programmer
c++
programming