[Aldor-l] alignof

Gabriel Dos Reis gdr at cs.tamu.edu
Fri Mar 21 19:58:05 EDT 2008


Stephen Watt <watt at scl.csd.uwo.ca> writes:

| Pippijn,
| 
| Can you give an example of a compiler and input for which the macro is incorrect ?

GCC, on x86.  Take T=double.  On my machine (x86), I get 8 with the macro.

The snag is that the alignment of double is not the same when it is a
member of a struct (alignment 4), or when it is the type of a
standalone datum (8).   So, whether you get the right answer depends
on the context of use. 

I knew this thread was ringing a bell to me. 

  http://gcc.gnu.org/ml/gcc/2003-04/msg01178.html


So, the exact value matters only if you're doing something very low-level
that it does matter whether the double is a member of a struct or not.
I do not know the details of Aldor source code, so only you and
Pippijn can conclude :-)

-- Gaby




More information about the Aldor-l mailing list