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-25 23:14:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!news-in-sanjose!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Size and pack References: X-Newsreader: Tom's custom newsreader Message-ID: <8b7C7.72629$gT6.36974049@news1.rdc1.sfba.home.com> Date: Fri, 26 Oct 2001 06:14:28 GMT NNTP-Posting-Host: 24.7.82.199 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.sfba.home.com 1004076868 24.7.82.199 (Thu, 25 Oct 2001 23:14:28 PDT) NNTP-Posting-Date: Thu, 25 Oct 2001 23:14:28 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:15216 Date: 2001-10-26T06:14:28+00:00 List-Id: >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; subtype str is String(1 .. 11); function to_str is new ada.unchecked_conversion(source=>Rx_Header_Data, target=>str); a : Rx_Header_Data; b : str; begin b := to_str(a); ----------- (Of course it's really ugly to use String where Storage_Element is clearly what is meant.)