Post Aw1kr7Q6ME2WEKHuoC by pointlessone@status.pointless.one
(DIR) More posts by pointlessone@status.pointless.one
(DIR) Post #Aw1gnJ18tfhJDwXXPs by wingo@mastodon.social
2025-07-11T10:02:58Z
0 likes, 0 repeats
my goodness, i had never seen this trick beforehttps://gustedt.wordpress.com/2025/06/30/the-provenance-memory-model-for-c/
(DIR) Post #Aw1gnK7Coc8qd2NtVQ by pointlessone@status.pointless.one
2025-07-11T10:30:12Z
0 likes, 0 repeats
@wingo One needs to know two consecutive elements of the list to traverse it which makes it even more annoying than a regular linked list.Head and tail are probably have to be kept somewhere as they have one of the pointers null. So a special case.I guess you’ve never seen it because it externalises a lot of state and it was discovered pretty fast that saved memory is not worth the trouble.
(DIR) Post #Aw1gnL90zNBPowEqxs by wolf480pl@mstdn.io
2025-07-11T14:18:47Z
0 likes, 0 repeats
@pointlessone @wingo > one of the pointers nullWho does that? I thought everyone is making their lists circular already...
(DIR) Post #Aw1gnOGDP3j1U8d96W by wingo@mastodon.social
2025-07-11T10:18:11Z
0 likes, 0 repeats
this is also the first thing i have read that argues *for* the use of the `register` keyword
(DIR) Post #Aw1gzjmFEMtZh0V1jk by wolf480pl@mstdn.io
2025-07-11T14:21:06Z
0 likes, 0 repeats
@wingo an interesting property is that this is effectively encryption, and not just any encryption, but a one-time-pad.I wonder if sth similar could be used for e2e enceypted distributed data structures or sth....
(DIR) Post #Aw1kr7Q6ME2WEKHuoC by pointlessone@status.pointless.one
2025-07-11T15:04:19Z
0 likes, 0 repeats
@wolf480pl It depends on what you’re doing with the list. Sometimes (I’d even say more often than not) you want a sequence and for that you need a start. And if you have a start you probably want an end as well.@wingo
(DIR) Post #Aw1mN2MYnM8DlaPoDw by wolf480pl@mstdn.io
2025-07-11T15:21:19Z
0 likes, 0 repeats
@pointlessone @wingo if you have a doubly-linked list, that means you wannt to be able to traverse it both ways. So you need both a head pointer and a tail pointer. But a structure with a head pointer and a tail pointer looks awfully like a list element with a next pointer and a prev pointer.So you use a fake element as the "list head", keep the list circular, and stop iteration when you detect you've come back to the fake element.1/
(DIR) Post #Aw1mk0lysAa7UnGDY0 by wolf480pl@mstdn.io
2025-07-11T15:25:28Z
0 likes, 0 repeats
@pointlessone @wingo This means that even if you're inserting or removing the element at the beginning, at the end, adding an element to an empty list or removing the last element - it all looks like inserting/removing in the middle, no special cases needed.So with a xor-pointer list you still wouldn't need to special-case the ends... but start of traversal would need to be special-cased... you could maybe still have only 1 fake element on an empty list tho