I am interested in a tool that parses through all the structs in my header files and determines where structure "padding" would be needed. For instance:
struct example {
char c1;
short s1;
char c2;
long l1;
char c3;
}
I am not interested in re-arranging the fields, but rather add "pad" variables. Do you know if this tool exists? If not, do you have an idea on how this would be implemented?
Ahh I see, looks like it is not very portable. I am sort of looking for something similar to Perl's pstruct, which prints the offset and size of each variable in a structure, taking in consideration where it would be padded.