Find holes in C structs due to alignment

c, memory-alignment, struct

Solution

You can use `pahole` to output information about holes in structures and optionally attempt packing them.

You may want to read "Poke-a-hole and friends" and the pahole announcement for more information

Problem

Is there a way in gcc or clang (or any other compiler) to spit information about whether a struct has holes (memory alignment - wise) in it ? Thank you. ps: If there is another way to do it, please do inform me.

Original source