DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT

Jamie Lokier jamie@shareable.org
Tue Apr 22 00:07:00 GMT 2003


Robert Dewar wrote:
> Yes, at least that's the intention in Ada. Setting an alignment for a type
> specifies a minimum alignment for objects.
> 
>   type A is ...
> 
>   B : A;
>   for B'Alignment use 4;
> 
>   Put_Line (Integer'Image (B'Alignment));
> 
> This must output 4. Of course the compiler could still silently put
> B on a bigger alignment, since there would be no way to tell that it
> was doing this systematically, but this would be a poor implementation.

Must it output 4 even if A'Alignment is 8?

I think it should be an error to say "for B'Alignment use 4" in that
case, but I don't know Ada.

-- Jamie



More information about the Gcc-patches mailing list