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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2e66fe8b30e3ee2c X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: S'Write and How To Count Bytes Date: 2000/10/03 Message-ID: <39D9DD58.86538032@acm.org>#1/1 X-Deja-AN: 677028282 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en X-Server-Date: 3 Oct 2000 13:21:44 GMT Content-Type: text/plain; charset=us-ascii Organization: Quadrus Corporation Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-10-03T13:21:44+00:00 List-Id: Mario Amado Alves wrote: > The "bottom line" was very simple: you may define the representation in > primary storage but not in secondary. This is what the ARM prescribes. I > also would like to see this changed in Ada20XX. Not quite. You can get around the whole mess very simply by creating a Stream_Element_Array of the appropriate size (minus the tag) and overloaying it on the object of your record type 'class. With the overlay you can compute checksums and whatever else you need, then blip the overlay down the wire. It could all be done in a class-wide operation so that it will handle all descendent types and avoids all the overhead of moving stuff around in memory and calling a bunch of small subprograms to convert the elementary objects to stream elements. You're guaranteed that your representation of data in memory is what you blipped down the wire because you just overlayed memory with a byte interpretation of it. The problem comes in when you try to start slamming representation clauses on tagged record types. You encounter a) problems with freezing rules. b) problems with alignments on descendent types, c) compiler bugs, d) no attributes for determining the size/placement of the tag within the record (implementation dependence is about all this causes) e) compiler obstinance in refusing to give you what you want. IMHO, it would work much nicer and more efficiently than relying on the stream attributes, but you just can't seem to get it to work all the way through. MDC -- ====================================================================== Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/ Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m Visit my web site at: http://www.mcondic.com/ "Giving money and power to Government is like giving whiskey and car keys to teenage boys." -- P. J. O'Rourke ======================================================================