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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38ceb882eed41e1e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-10 01:59:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!195.86.7.162!newsfeed.wirehub.nl!195.129.110.18.MISMATCH!bnewspeer00.bru.ops.eu.uu.net!emea.uu.net!newsfeed.siemens.de!news.siemens.de!news.mch.sbs.de!not-for-mail From: Alfred Hilscher Newsgroups: comp.lang.ada Subject: Re: Size and pack Date: Wed, 10 Oct 2001 10:59:30 +0200 Organization: Siemens AG Message-ID: <3BC40DF2.9447F025@icn.siemens.de> References: <9ff447f2.0110100005.2503bb00@posting.google.com> NNTP-Posting-Host: 139.21.122.158 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (WinNT; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:14125 Date: 2001-10-10T10:59:30+02:00 List-Id: I'm not sure, but I think it is because Log_Num would start on an odd adress otherwise, and so there are three bytes left to align it to a word boundary. Yes, shou should be able to do it with rep-spec. Adrian Hoe wrote: > > Hello, > > I have the following declaration: > > type Rx_Header_Data is > record > Start_Byte : Character := Latin_1.STX; > Splitter : Character; > Command_Byte : Character; > Pad_Byte_1 : Character; > Pad_Byte_2 : Character; > Log_Num : Interfaces.C.Long; > End_Byte : Character := Latin_1.ETX; > LRC : Character; > end record; > > It supposed to be 11 bytes long but Rx_Header_Data'Size reports 14 > bytes. 'Size will report 11 bytes when I add the following line: > > pragma pack (Rx_Header_Data); > > I have found that Log_Num : Interfaces.C.Long takes up 7 bytes without > pragma pack. > > Why this happens? Can I use representation clause instead of pragma > pack? If both methods work, which is the best approach and why? > > I use GNAT 3.13p on Linux. > > Thank you.