Maven (famous)@lemmy.zip to Programmer Humor@programming.dev · 9 days agoI love new featureslemmy.zipexternal-linkmessage-square19fedilinkarrow-up19arrow-down10
arrow-up19arrow-down1external-linkI love new featureslemmy.zipMaven (famous)@lemmy.zip to Programmer Humor@programming.dev · 9 days agomessage-square19fedilink
minus-squarebleistift2@sopuli.xyzlinkfedilinkEnglisharrow-up0arrow-down1·8 days ago linked lists, trees, objects with references to other objects That’s not a pointer to another pointer, but a pointer to a data structure that happens to contain another pointer.
minus-squareLightfire228@pawb.sociallinkfedilinkarrow-up1·edit-28 days agoThe distinction is meaningless in the land of Opcode’s and memory addresses For example, a struct is just an imaginary “overlay” on top of a contiguous section of memory Say you have a struct struct Thing { int a; int b; Thing* child; } Thing foo {} You could easily get a reference to foo->child->b by doing pointer arithmetic *((*((*foo) + size(int)*2)) +size(int)) (I’ve not used C much so I’ve probably got the syntax wrong)
That’s not a pointer to another pointer, but a pointer to a data structure that happens to contain another pointer.
The distinction is meaningless in the land of Opcode’s and memory addresses
For example, a struct is just an imaginary “overlay” on top of a contiguous section of memory
Say you have a struct
struct Thing { int a; int b; Thing* child; } Thing foo {}
You could easily get a reference to
foo->child->b
by doing pointer arithmetic*((*((*foo) + size(int)*2)) +size(int))
(I’ve not used C much so I’ve probably got the syntax wrong)