[Haskell-cafe] Begginer question about alignment in Storable

Maurí­cio briqueabraque at yahoo.com
Sat Nov 15 15:29:23 EST 2008


Hi,

I need to make the following structure into
an instance of Storable:

struct {
   double w[2];
}

Can I assume that its function 'alignment' should
return the same as "alignment (1::CDouble)"? Or
should it be "2 * alignment (1::CDouble)"?

(I've read the wikipedia article about memory alignment,
and what I understand is that there's a better alignment
for hardware efficiency but compilers and programmers can
do almost anything about it. What can I do when writing
a library wrapper if I don't know what kind of compiler
pragmas were used in all platforms that library was
compiled?)

Thanks,
Maurício



More information about the Haskell-Cafe mailing list