Wrote this blog post to summarize what I think are the right ways to understand alignment and size for various data types in Zig, just through experimentation.
Let me know any and all feedback!
struct Dang : bits 64 // 64 bits wide, int total
{
foo : bits 5 @ 0; // 5 bits wide at bit offset 0
bar : bits 5 @ 0;
baz : bits 16 @ 4; // 16 bits wide at bit offset 4
tom : bits 11 @ 32;
};I have worked with a number of fresh grads over the last ten years. I can think of one who may have had a good handle on this. At best the rest range from “vague memory recall about this” to a blank stare.
On the flip hand, it’s something someone can pick up pretty quickly if motivated.