This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT



On Thursday, Apr 17, 2003, at 16:15 America/New_York, Alexandre Oliva wrote:
Ok, you got me curious.  Would you mind explaining to an Ada-clueless
person how come these two cases can possibly be different?  In my
C-centric view, I really can't see the difference.  Code snippets
demonstrating the semantic difference would be highly appreciated.


Below is an example which is required not to raise Program_Error:


with System.Storage_Elements; use System.Storage_Elements;
procedure T is

   type Point is record
      X, Y, Z : Long_Float;
   end record;

   type Path is array (Positive range <>) of Point;
   pragma Pack (Path);

   Q : Point;
   for Q'Alignment use 16;

begin
   if Q'Address mod 16 /= 0 then
      raise Program_Error;
   end if;
end T;


Waiting to be enlightened, :-)

Hope the example helps. Yell if not :-)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]