From a51929b73d85706b307867005775f72482590602 Mon Sep 17 00:00:00 2001
From: "Papp, Gyozo"
+ A Zig packed struct behaves differently when it stands alone in the memory (non-packed + location) and when it is embedded in another packed struct or union as a field (packed + location). A Zig packed struct is also not the same as a packed struct attribute in C. + The following table highlights some differences: +
+Property | +Zig packed struct in non-packed location | +Zig packed struct in packed location | +C packed struct | +
---|---|---|---|
Size | +Size of the backing integer. | +Total number of bits of the fields. | +Total number of bytes of the fields. | +
Alignment | +Alignment of the backing integer. | +Can start at any bit offset. | +1 byte. | +
Since all structs are anonymous, Zig infers the type name based on a few rules.