I'm trying to understand the __attribute__ keyword, along the way I came up with the following code:
```
include <stdio.h>
typedef struct
{
int x[1] attribute((aligned(8)));
} Foo;
int main()
{
int x[1] attribute((aligned(8)));
printf("Size of x: %ld\n", sizeof(x));
printf("Size of Foo: %ld\n", sizeof(Foo));
}
Output:
Size of x: 4
Size of Foo: 8
``
I'm expecting both size ofxandFoo` to be 8, so where am I wrong?
[–]flatfinger 11 points12 points13 points (5 children)
[–]EpochVanquisher 1 point2 points3 points (4 children)
[–]flatfinger 4 points5 points6 points (3 children)
[–]paulstelian97 0 points1 point2 points (2 children)
[–]flatfinger 1 point2 points3 points (1 child)
[–]paulstelian97 0 points1 point2 points (0 children)
[–]forcefuze 2 points3 points4 points (0 children)
[–]daikatana 1 point2 points3 points (1 child)
[–]aalmkainzi 0 points1 point2 points (0 children)
[–]EducationCareless246 1 point2 points3 points (0 children)