The great inapplicable attribute debate

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Tue Apr 14 15:34:06 PDT 2009


Christopher Wright wrote:
> Frits van Bommel wrote:
>> But the union's alignment needs to be sufficient for all members, so 
>> it depends on the maximum alignment of all members.
> 
> Or the least common multiple, assuming that align accepts arguments that 
> are not powers of 2.

I have never seen "alignment" used to describe addresses at a multiple of 
anything but a power of two.

In fact, common object file formats (That I know of: ELF and LLVM bitcode) 
enforce this by only allowing alignments to be specified as powers of two. ELF 
does this by storing the log of the alignment instead of the alignment itself; 
LLVM currently encodes the full value for backward compatibility but asserts if 
this isn't a power of two (or zero) and IIRC they plan to switch to log-storage 
for LLVM 3.0 if and when it comes out.



More information about the Digitalmars-d mailing list