From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a5aa52a6f866183 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-27 13:17:53 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!news.moneng.mei.com!uwm.edu!news.alpha.net!news.mathworks.com!transfer.stratus.com!noc.near.net!ray.com!news.ray.com!news.ed.ray.com!swlvx2!jgv From: jgv@swl.msd.ray.com (John Volan) Subject: Re: Flags in Ada? Date: Thu, 27 Oct 1994 15:15:32 GMT Message-ID: <1994Oct27.151532.14420@swlvx2.msd.ray.com> References: <38khst$hn3@news.delphi.com> <38mle1$e3m@gnat.cs.nyu.edu> Sender: news@swlvx2.msd.ray.com (NEWS USER) Organization: Raytheon Company, Tewksbury, MA Date: 1994-10-27T15:15:32+00:00 List-Id: 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."); --------------------------------------------------------------------------------