Lets assume I have a structure:
struct A {
uint16_t a;
uint64_t b;
};
is there a way to get the size of A w/o padding ? i.e.: The sum of sizeof of all the members (even if it is not recursive).
Normally sizeof(A) == 16.
I would like __GCC_sizeof__(A) == 10
.
I want it in a test code w/o affecting the actual code, which means no "#pragma"
s and no "__attribute__"
in the structure definition.
(Though it can be done with #ifdef TEST
, but it is very ugly).
It doesn't have to be portable, GCC
is enough.
Thanks!