fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #pragma pack(push, 16)
  5. struct Foo {
  6. int a;
  7. };
  8. #pragma pack(pop)
  9.  
  10. struct Foo1 {
  11. int a;
  12. } __attribute__((aligned(16)));
  13.  
  14. int main() {
  15. cout << "sizeof(struct Foo) = " << sizeof(struct Foo) << endl;
  16. cout << "sizeof(struct Foo1) = " << sizeof(struct Foo1) << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
sizeof(struct Foo) = 4
sizeof(struct Foo1) = 16