alignment of array

massimiliano cialdi
Mon Mar 10 11:25:00 GMT 2008

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__ ?


È difficile non desiderare la donna d'altri, dato che quelle di
nessuno di solito sono poco attraenti. - Enzo Biagi

Massimiliano Cialdi

More information about the Gcc-help mailing list