0

Consider the code:

struct A
{
    char b;
    bool a;
    double c;
};

struct B
{
    char b;
    double c;
    bool a;
};

int main()
{
    std::cout << sizeof(A) << '\n'; // 16
    std::cout << sizeof(B) << '\n'; // 24
}

Whats happening here ? What are purposes in a second case to be aligned by a 8 bytes ??

(OS: windows 7 32 bit)

ampawd
  • 968
  • 8
  • 26

0 Answers0