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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7345e706c651a1a3 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!postnews.google.com!q19g2000prn.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: pragma Pack does not work on GNAT 5.01a for Redhat Linux. Date: Tue, 19 Jun 2007 09:23:17 -0700 Organization: http://groups.google.com Message-ID: <1182270197.106022.112630@q19g2000prn.googlegroups.com> References: <1182259013.590515.118310@g4g2000hsf.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1182270197 10995 127.0.0.1 (19 Jun 2007 16:23:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 19 Jun 2007 16:23:17 +0000 (UTC) In-Reply-To: <1182259013.590515.118310@g4g2000hsf.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q19g2000prn.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news1.google.com comp.lang.ada:16242 Date: 2007-06-19T09:23:17-07:00 List-Id: On Jun 19, 6:16 am, petter_frykl...@hotmail.com wrote: > The Size of the following record is 112 on Linux, but 104 on Solaris. > > type Something is record > A : Packed_16; > B : Packed_8; > C : Packed_8; > D : Packed_8; > E : Packed_32; > F : Packed_32; > end record; > pragma Pack (Something); > > Where > > type Packed_Byte is mod 2 **8; > for Packed_Byte'Size use 8; > > type Packed_Bytes is array (Natural range <>) of Packed_Byte; > for Packed_Bytes'Alignment use 1; > for Packed_Bytes'Component_Size use Packed_Byte'Size; > > type Packed_8 is new Packed_Bytes (0 .. 0); > for Packed_8'Size use 8; > > and similar. Why is pragma Pack ignored? Strange... I get 104 when I try it on Linux. I could be using a different version of GNAT, though. -- Adam package Test109pak is type Packed_Byte is mod 2 **8; for Packed_Byte'Size use 8; type Packed_Bytes is array (Natural range <>) of Packed_Byte; for Packed_Bytes'Alignment use 1; for Packed_Bytes'Component_Size use Packed_Byte'Size; type Packed_8 is new Packed_Bytes (0 .. 0); for Packed_8'Size use 8; type Packed_16 is new Packed_Bytes (0 .. 1); for Packed_16'Size use 16; type Packed_32 is new Packed_Bytes (0 .. 3); for Packed_32'Size use 32; type Something is record A : Packed_16; B : Packed_8; C : Packed_8; D : Packed_8; E : Packed_32; F : Packed_32; end record; pragma Pack (Something); end Test109pak; with Test109pak; with Text_IO; procedure Test109 is begin Text_IO.Put_Line ("Size is " & Integer'Image (Test109pak.Something'Size)); end Test109;