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
I Don't know any automatic tool, but this could be helpful example:
#include
struct test {
typea a;
typeb b;
typec c;
};
int gapB = offsetof(struct test, b) - (offsetof(struct test, a) + sizeof(typea));
int gapC = offsetof(struct test, c) - (offsetof(struct test, b) + sizeof(typeb));
printf("Gap of b:%d/n", gapB);
printf("Gap of c:%d/n", gapC);
*Note: you will have to do so for each two members in your stuck.