Get the latest tech news
Zig's new LinkedList API (it's time to learn fieldParentPtr)
Karl Seguin's Blog - A mix of coding and creative writing
Specifically, unless we're using a packed or extern struct, Zig makes no guarantees about the layout of a structure. To make this code safer, we use the@offsetOf builtin to get the actual byte-offset of a field with respect to its struct: My initial reaction is that I dislike exposing, what I consider, a complicated builtin like@fieldParentPtr for something as trivial as using a linked list.
Or read this on Hacker News