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.7 required=5.0 tests=AXB_XMAILER_MIMEOLE_OL_024C2, BAYES_00,MAILING_LIST_MULTI autolearn=no 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-11 04:18:59 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Size and pack Date: Thu, 11 Oct 2001 06:18:20 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <9ff447f2.0110100005.2503bb00@posting.google.com> <3BC57091.51ECCE8D@CCI.Sema.de> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1002799136 82620 137.194.161.2 (11 Oct 2001 11:18:56 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 11 Oct 2001 11:18:56 +0000 (UTC) Cc: , , To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:14237 Date: 2001-10-11T06:18:20-05:00 ----- Original Message ----- From: "Lutz Donnerhacke" Newsgroups: comp.lang.ada To: Sent: October 11, 2001 5:19 AM Subject: Re: Size and pack > * Vincent Smeets wrote: > >Adrian Hoe wrote: > >> 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; > > > >Just an other view and a question to CLA, > > > >If you read and write this record thrue a stream, will you then get the > >correct byte layout (with Log_Num at an odd byte)? > > I do not see a reason for expecting it. The Implementation may choose to > start with a type marker and than dumps the current memory area. > The above answer is completely wrong. The language standard is very clear about the behavior of stream attributes. Whether this type is written with 'Outpuit or 'Write, there will be exactly eleven stream elements written to the stream. Since this is not a tagged type, there is no "type marker" to write. Furthermore, the behavior of 'Output and 'Write for this type is unaffected by how the compiler chooses to lay out the record in memory -- whether 11 bytes or 14 bytes, or some other size, or even if the compiler should choose a different order in which to lay out the components. To say "then dumps the current memory area" is misleading at best. If this _were_ a tagged type, then the behavior of 'Write would be exactly as described above, but 'Output would precede the data with the External_Tag of the type. Since an External_Tag is a string, the stream representaion of an External_Tag is first a Standard.Integer containing the length of the string, followed by the characters of the string. Furthermore, this behavior is unaffected by any representation clause or Pragma Pack. LRM 13.13.2 describes this behavior in detail. _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada >