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,3110709241972620 X-Google-Attributes: gid103376,public From: Corey Minyard Subject: Re: Packing Record Structures in Ada Date: 1998/01/13 Message-ID: #1/1 X-Deja-AN: 315604361 Sender: minyard@wf-rch.cirr.com References: <884639188.24707084@dejanews.com> Organization: Wonderforce Research Newsgroups: comp.lang.ada Date: 1998-01-13T00:00:00+00:00 List-Id: dewar@merv.cs.nyu.edu (Robert Dewar) writes: > > THe stream facility in Ada 95 is one of its very powerful features. I have > the impression that a lot of Ada 95 programmers are not sufficiently aware > of this very important capability, and its wide applicability to solving > problems of this nature, either through explicit use, or implicit use via > the distribution annex. > >From my reading of the ARM, it is not extremely clear to me that streaming between different compilers is 100% compatible. It may be (I haven't read the AARM and I'm no language expert) and I would expect it would be in general (assuming endian-ness conversion is done, of course). I have done tests of streaming vs direct layout and copying using GNAT. Streaming is rather slow, on the order of 20 times slower than direct copying. I would expect this is due to a polymorphic call on every data item (every array element, etc.), so I wouldn't expect any other compilers to be any better. With a representation clause, layouts are guaranteed except for endianness, and you can directly copy the data structure. If you were able to do a "for T'Bit_Order use ..." would that solve the endianness problem? I realize that compilers do not have to allow this, but if they did... -- Corey Minyard Internet: minyard@acm.org Work: minyard@nortel.ca UUCP: minyard@wf-rch.cirr.com