A great article. For an optimized and/or secure system, it’s important to pay attention to these small details of how things look in memory.
However, I can’t believe I didn’t know about the pahole tool - I’ve been manually inserting those offset comments when optimizing…
I recently wrote an article about a similar topic - and one thing I wrote about is what unaligned accesses look like in memory and why they are bad or simply not allowed:
http://www.shincbm.com/embedded/2022/02/18/struct-layout-code-size.html