fork download
  1. #include <cstddef>
  2. #include <cassert>
  3.  
  4. template<int size>
  5. class Padding {
  6. char padding[size];
  7. };
  8. //User can't do _anything_ with this type
  9. //except make it, copy it, and destruct it.
  10.  
  11. struct Name {
  12. long Id;
  13. Padding<32> padding;
  14. float X;
  15. };
  16.  
  17. int main() {
  18. assert(sizeof(int) == 4);
  19. assert(sizeof(long) == 4);
  20. assert(sizeof(float) == 4);
  21. assert(offsetof(Name, Id) == 0);
  22. assert(offsetof(Name, X) == 0x24);
  23. Name a;
  24. }
Success #stdin #stdout 0.02s 2720KB
stdin
Standard input is empty
stdout

Standard output is empty