This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: alignment of array
massimiliano cialdi wrote:
> I need to change this:
>
> char Array0[N] __attribute__ ((aligned (4)));
> char Array1[M] __attribute__ ((aligned (4)));
>
> In something like this:
>
> typedef char myType_t __attribute__ ((aligned (4)));
> myType_t Array0[N];
> myType_t Array1[M];
>
> but of course in this case the compiler gives me the following error
> "alignment of array elements is greater than element size"
>
> Is there a way to declare a type in such a way that ie Array0 and
> Array1 are automatically aligned without using __attribute__ ?
A union with a larger type would work.
Andrew.