summaryrefslogtreecommitdiff
path: root/exercises/111_packed.zig
AgeCommit message (Collapse)Author
2026-04-03Insert space for additional async exercisesChris Boesch
2026-03-13111/112: Add exercises for packed structs/unionsJustus Klausecker
The first exercise introduces the `packed` keyword as an alternative for bitwise operations. Its main goals are establishing a solid understanding of field order and conveying the fact that packed containers are basically integers. It introduces the concept of container layouts and briefly explains the default `auto` layout before introducing the `packed` layout (but doesn't touch `extern` at all). The exercise also presents a real-world use case for packed containers, namely LZ4 frame descriptors. Furthermore it covers equality comparisons between packed containers. The second exercise talks about switch statements with packed containers and goes into some more detail on packed unions.