comp.lang.ada
 help / color / mirror / Atom feed
From: jgv@swl.msd.ray.com (John Volan)
Subject: Re: Flags in Ada?
Date: Thu, 27 Oct 1994 15:15:32 GMT
Date: 1994-10-27T15:15:32+00:00	[thread overview]
Message-ID: <1994Oct27.151532.14420@swlvx2.msd.ray.com> (raw)
In-Reply-To: 38mle1$e3m@gnat.cs.nyu.edu

The way I understand it, applying pragma Pack to a record type will
only guarantee that the record type will be optimized for space.  I
don't think there's anything in the language definition that requires
a compiler to preserve the order of the components.  In fact, RM9X
13.2(8);5.0 states that an implementation may reorder components to
improve the packing.

I grant you that the most straightforward implementation of Pack would
simply pack the components in the order they were originally declared,
and I expect that that's the way GNAT deals with it.  Nevertheless, I
can imagine some super-optimizing compiler that juggled the components
around to get a better fit.  

So if you have an external requirement that each component occupy
specific positions, such as when you're communicating with hardware or
operating-system services, then I think you'd need to use a
representation clause.  You can't just rely on the components being
stored in the order you declared them.

--------------------------------------------------------------------------------
--  Me : Person := (Name                => "John Volan",
--                  Company             => "Raytheon Missile Systems Division",
--                  E_Mail_Address      => "jgv@swl.msd.ray.com",
--                  Affiliation         => "Enthusiastic member of Team Ada!",
--                  Humorous_Disclaimer => "These opinions are undefined " &
--                                         "by my employer and therefore " &
--                                         "any use of them would be "     &
--                                         "totally erroneous.");
--------------------------------------------------------------------------------





  parent reply	other threads:[~1994-10-27 15:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-25 10:36 Flags in Ada? Andre Spiegel
1994-10-25 10:07 ` David Emery
1994-10-25 16:19 ` Norman H. Cohen
1994-10-26  3:19   ` tmoran
1994-10-26  9:59     ` David Emery
1994-10-26 22:32       ` Robert Dewar
1994-10-27 13:24         ` Norman H. Cohen
1994-10-27 15:15         ` John Volan [this message]
1994-10-31  9:29         ` David Emery
1994-10-27 22:34       ` Henry G. Baker
1994-10-26 14:33     ` Robert Dewar
1994-10-26 17:43     ` Norman H. Cohen
1994-10-26 15:54   ` Andre Spiegel
1994-10-26  0:36 ` Dale Stanbrough
1994-10-26 11:01   ` Robert Dewar
1994-10-27  8:23 ` Henri Altarac
1994-10-27 23:00   ` Robert Dewar
1994-10-31  9:32     ` David Emery
  -- strict thread matches above, loose matches on Subject: below --
1994-10-25 16:22 tmoran
1994-10-27  5:05 tmoran
1994-10-27 13:29 ` Robert Dewar
1994-10-27 17:15 ` Norman H. Cohen
1994-10-28  3:51   ` Robert Dewar
1994-10-27  5:06 tmoran
1994-10-27 13:47 ` Robert Dewar
1994-10-28  2:41   ` Tucker Taft
1994-10-30 13:31     ` Robert Dewar
1994-10-28  3:59 tmoran
1994-10-28 13:43 ` Robert Dewar
1994-10-31 14:19   ` Norman H. Cohen
1994-11-02 14:06     ` Mats Weber
1994-11-03 23:08       ` Robert Dewar
1994-11-03 11:26     ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox