Skip to content

Commit

Permalink
style: packed structs (#202)
Browse files Browse the repository at this point in the history
style: packed structs

Explain that structs must be packed (not contain any implicit padding).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
  • Loading branch information
lsf37 committed Oct 18, 2023
1 parent d4bd9b0 commit 7b0cc2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions processes/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ anything in the general guide.
* Do not use `typedef` to create a type alias for an `enum`; always
specify `enum` types as `word_t` (otherwise, the `enum` size is
determined by the compiler).
* All `struct` definitions must be packed, i.e. not contain any implicit padding
that is inserted by the compiler (otherwise memory content is
unspecified). Use explicit `padding` fields of the required type size to
remove implicit compiler padding.
## Further resources
Expand Down

0 comments on commit 7b0cc2c

Please sign in to comment.