Struct padding, alignment and wire formats
Reason about object layout, padding and alignment across compilers, and distinguish in-memory representations from protocol formats.
View lesson accessAll lessonsWhat the lesson covers
The course lesson is called The 12-byte packet. The Monday after the demo: one packet struct is 12 bytes on the board and 8 on the simulator, and the bytes in between are leaking.
- alignment
- padding
- member order
- packed
- wire formats
Before you start
Question to think about: Why might two systems disagree about the byte layout of the same C structure?
Preparation exercise: Sketch a few member layouts and list the assumptions you would need to verify with the target compiler.
This is an original public study prompt, not the paid lesson or its solution. The interactive course contains the walkthroughs, labs, exercises and recaps.
Related free reading
Test your understanding
Practice free firmware interview questions and mock interviews · Assess your readiness