language: C++ 4.7.2 (gcc-4.7.2)
date: 226 days 6 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
 
#pragma pack(push, 1)
struct A
{
    int a;
    char b;
};
#pragma pack(pop)
 
struct B : public A
{
    int c;
};
 
int main()
{
    std::cout << "Size of A:  " << sizeof(A) << std::endl;
    std::cout << "Size of B:  " << sizeof(B) << std::endl;
    return 0;
}