Firstly, I understand byte padding in structs. But I have still a small test contain a double field in struct and I don\'t know how to explain this :
typedef
What is strange to you (or I'm missing something)?
The logic is the same (the padding is according to the "biggest" primitive field in the struct (I mean - int, double, char, etc.))
As in single, you have
1 (sizeof(char)) + 3 (padding) + 4 (sizeof(int))
it's the same in data:
1 (sizeof(char)) +
7 (padding, it's sizeof(double) - sizeof(char)) +
8 (sizeof(double))
which is 16.