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,LOTS_OF_MONEY 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-26 16:21:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BD9EFEA.FFE78DA4@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Size and pack References: <8b7C7.72629$gT6.36974049@news1.rdc1.sfba.home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 26 Oct 2001 23:21:20 GMT NNTP-Posting-Host: 63.180.2.44 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1004138480 63.180.2.44 (Fri, 26 Oct 2001 16:21:20 PDT) NNTP-Posting-Date: Fri, 26 Oct 2001 16:21:20 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Fri, 26 Oct 2001 16:17:29 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:15284 Date: 2001-10-26T23:21:20+00:00 List-Id: Smark wrote: > > wrote in message > news:8b7C7.72629$gT6.36974049@news1.rdc1.sfba.home.com... > > >As you indicated in another post, neither pragma pack nor a rep clause > > >gives you what you want. This is because neither of these will violate > > >the alignment rules for a given type. > > I seem to have missed the previous post, so I don't know what the > > problem is. The following code works just fine - isn't it what you want? > > 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; > > for Rx_Header_Data use > > record > > Start_Byte at 0 range 0 .. 7; > > Splitter at 1 range 0 .. 7; > > Command_Byte at 2 range 0 .. 7; > > Pad_Byte_1 at 3 range 0 .. 7; > > Pad_Byte_2 at 4 range 0 .. 7; > > Log_Num at 5 range 0 .. 31; > > End_Byte at 9 range 0 .. 7; > > LRC at 10 range 0 .. 7; > > end record; > > for Rx_Header_Data'size use 8*11; > > The problem was that this rep clause will not work, because Log_Num must > be aligned to a 4-byte boundary. Some compilers will silently ignore your > rep clause, I believe GNAT will tell you it can't do it. You don't seem to be paying attention. He said, "[This] code works just fine". That probably means he tested it. I have compiled and linked it with GNAT 3.13p/Win98 without any problem. On what compiler/target did your test reject this rep clause? -- Jeff Carter "I wave my private parts at your aunties." Monty Python & the Holy Grail