mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
111/112: Add exercises for packed structs/unions
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.
This commit is contained in:
Reference in New Issue
Block a user