fork download
  1. #include <stdio.h>
  2.  
  3. struct cache_line_aligned {
  4. int version;
  5. // char padding[60];
  6. } __attribute__ ((aligned (64)));
  7.  
  8. int main(void)
  9. {
  10. struct cache_line_aligned s;
  11. struct cache_line_aligned a[2];
  12. printf("sizeof(struct cache_line_aligned) = %d\n", (int)sizeof(struct cache_line_aligned));
  13. printf("sizeof(s) = %d\n", (int)sizeof(s));
  14. printf("sizeof(a[0]) = %d\n", (int)sizeof(a[0]));
  15. printf("sizeof(a) = %d\n", (int)sizeof(a));
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
sizeof(struct cache_line_aligned) = 64
sizeof(s) = 64
sizeof(a[0]) = 64
sizeof(a) = 128