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,febd9e55846c9556 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-03 08:27:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Endianness independance Date: 03 Mar 2003 11:11:44 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1046708739 19578 128.183.235.92 (3 Mar 2003 16:25:39 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 3 Mar 2003 16:25:39 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:34829 Date: 2003-03-03T16:25:39+00:00 List-Id: Lionel.DRAGHI@fr.thalesgroup.com writes: > | -----Message d'origine----- > | De: Marin David Condic [mailto:mcondic.auntie.spam@acm.org] > ... > | > | Realistically, the answer is to assess the communications > | mechanisms needed, > | establish a clearly defined protocol & representation and > | then build your > | software to deal with that. Ada can be very good at handling the > | representation selected, but it really can't define the > | representation for > | you. > > I agree with this. > What i am complaining about, is that you can't just rely on representation > clauses to have interoperability between the same code compiled on two > different platform, and exchanging data through a stream socket for exemple. > I think that the representation/size/alignment clauses could give enough > informations to the compiler to ensure interoperability (provided RM > modifications). It is not possible to get compatible stream representations via representation clauses. You must override 'Write and 'Read to get that. The reason is that representation clauses can't swap bytes within scalars (integers and floats), as is required by endian-independant stream representations. > Am i wrong? No. > As said Amir Yantimirov: "But including notion of endianess (as kind > of storage specifier) in existent Ada type system seems impossible > to me." The problem is there are _two_ requirements for endianness; 1) match the native hardware 2) match the stream representation The compiler matches the native hardware for scalars, and rep clauses allow you to match the native hardware for records. Stream attributes allow you to match the stream representation. This allows for more complex things than just endianness. > Note that Norman Cohen's paper do not address the whole > interoperability problem, he just propose a way to portably specify > "a data layout". Correct. He addresses 1) above, but not 2). > However, this is, i think, the most difficult part of the job. The most difficult part is the one you haven't figured out yet; everything else is easy :). -- -- Stephe