diff --git a/doc/langref.html.in b/doc/langref.html.in index 9f12829349fa..b5643b6c4148 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -2250,6 +2250,40 @@ or

{#header_close#} +

+ 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: +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Differences between Zig and C packed structs
PropertyZig packed struct in non-packed locationZig packed struct in packed locationC packed struct
SizeSize of the backing integer.Total number of bits of the fields.Total number of bytes of the fields.
AlignmentAlignment of the backing integer.Can start at any bit offset.1 byte.
+
+ {#header_open|Struct Naming#}

Since all structs are anonymous, Zig infers the type name based on a few rules.