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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Addressing in Object Ada v/s GNAT (2013) showing Vast Differences Date: Thu, 10 Sep 2015 14:34:16 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 10 Sep 2015 12:32:24 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="15798"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OxsfHEbEkGZNy6AKkZX9y4KK6Da8GnHA=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: Cancel-Lock: sha1:prBefvfd0X9dTjaV+nyLllKPA+Q= Xref: news.eternal-september.org comp.lang.ada:27760 Date: 2015-09-10T14:34:16+02:00 List-Id: On 10.09.15 12:47, Lucas Redding wrote: > I need to change the alignment of each underlying type mapped into memory. I am hoping the combination of explicit alignments and precise rep clauses (size etc.) should make the code portable between compilers. You are certainly aware of mappings that can be effected by just using a type conversion? This way, some of the less portable representations can be stashed away. package P is type T1 is range 1 .. 10; type T2 is range -1_000 .. +1_000; type Internal is record A : T1; B : T2; end record; type Mapped is new Internal; for Mapped'Size use 32; for Mapped'Alignment use 1; for Mapped use record A at 0 range 0 .. 7; B at 0 range 11 .. 30; end record; end P; with P; procedure Test_P is Z : P.Mapped; pragma Volatile (Z); procedure Place (Value : P.Internal) is begin Z := P.Mapped (Value); pragma Inspection_Point (Z); end Place; begin Place( P.Internal'(A => 3, B => 42) ); end Test_P;