fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct test {
  5. uint32_t t1:20;
  6. uint32_t t2:20;
  7. uint32_t t3:20;
  8. uint32_t t4:20;
  9. uint32_t t5:20;
  10. uint32_t t6:20;
  11. uint32_t t7:20;
  12. uint32_t t8:20;
  13. };
  14.  
  15. struct test2 {
  16. uint64_t t1:20;
  17. uint64_t t2:20;
  18. uint64_t t3:20;
  19. uint64_t t4:20;
  20. uint64_t t5:20;
  21. uint64_t t6:20;
  22. uint64_t t7:20;
  23. uint64_t t8:20;
  24. };
  25. int main() {
  26. cout << "test is "<<sizeof(test)<<" bytes compared to "<<8*sizeof(uint32_t)<<endl;
  27. cout << "test2 is "<<sizeof(test2)<<" bytes compared to "<<8*sizeof(uint32_t)<<endl;
  28. return 0;
  29. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
test is 32 bytes compared to 32
test2 is 20 bytes compared to 32