[MLton] x86_64 port status
Vesa Karvonen
vesa.karvonen@cs.helsinki.fi
Wed, 10 May 2006 09:25:21 +0300
Quoting skaller <skaller@users.sourceforge.net>:
> On Tue, 2006-05-09 at 16:31 -0700, Stephen Weeks wrote:
> > > Perhaps a better approach would be to define the following:
> > >
> > > struct PointerAux { unsigned char[4]; } __attribute__ ((aligned (4));
> > > typedef struct PointerAux* Pointer;
> >
> > I tried this out and it worked well. To be clear, I used
> >
> > struct PointerAux { unsigned char z[4]; } __attribute__ ((aligned (4)));
>
> But this only works for gcc! Please use a union to align
> data, it's portable to all compilers and architectures.
Sorry, I haven't followed this discussion closely. Do you mean
a union like below?
union PointerAux {
char c;
short s;
int i;
long l;
/* ... where all types have sizeof <= 4 */
};
-Vesa Karvonen