Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. quentin@chrystal ~/tmp $ cat align.c 0
  2. #include <stdio.h>
  3.  
  4. struct foo {
  5. int teton;
  6. char bar;
  7. unsigned long foo;
  8. char foobar;
  9. } __attribute__((align(32)));
  10.  
  11. struct foo my_array[42];
  12. struct foo my_array[42] __attribute__((align(32)));
  13.  
  14. int main(void)
  15. {
  16. printf("sizeof==%lu, %p %p\n", sizeof(struct foo), my_array, my_array + 1);
  17. return 0;
  18. }
  19. quentin@chrystal ~/tmp $ make align 0
  20. cc align.c -o align
  21. align.c:8:1: warning: ‘align’ attribute directive ignored [-Wattributes]
  22. } __attribute__((align(32)));
  23. ^
  24. align.c:11:8: warning: ‘align’ attribute directive ignored [-Wattributes]
  25. struct foo my_array[42] __attribute__((align(32)));
  26. ^
  27. quentin@chrystal ~/tmp $ ./align 0
  28. sizeof==24, 0x601060 0x601078
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement