←back to thread

Indices, not Pointers

(joegm.github.io)
102 points vitalnodo | 1 comments | | HN request time: 0.198s | source
1. xorvoid ◴[] No.45124059[source]
It’s a fairly well-known trick in systems programming. Definitely not invented with zig, but perhaps popularized further.

If you write enough systems code in C or Rust, you end up inventing it eventually.

If you ever design a datastructure for multi-process shared memory (e.g. tmpfs mmap() on Linux), the only way you can do object references is with the “offsets”, since each process can map the region to different addresses.