fork(2) download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. typedef struct {
  8. int id;
  9. int type;
  10. const char *name;
  11. const char *long_name;
  12. int props;
  13. const char *const *mime_types;
  14. const char *const *profiles;
  15. } UnPacked;
  16.  
  17. #pragma pack(4)
  18. typedef struct {
  19. int id;
  20. int type;
  21. const char *name;
  22. const char *long_name;
  23. int props;
  24. const char *const *mime_types;
  25. const char *const *profiles;
  26. } Packed;
  27.  
  28.  
  29. int main(int argc, const char * argv[])
  30. {
  31. cout << "UnPacked: " << sizeof(UnPacked) << endl;
  32. cout << "Packed : " << sizeof(Packed) << endl;
  33. }
  34.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
UnPacked: 48
Packed  : 44