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,9ae3749ddf1e6022 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Endian and Ada Date: 1996/04/08 Message-ID: #1/1 X-Deja-AN: 146415177 references: <4kamb9$om2@flute.aix.calpoly.edu> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-04-08T00:00:00+00:00 List-Id: Mike asks "I'm taking a computer architecture class and my eyes have been opened to the incredible lack of progress that computer science has made in the area of architecture-independant programming. One of the main problems that my professor likes to point out the endian problem and the fact that so much software is *not* endian-independant (due mainly to the widespread use of C and C++). However, he is not familiar enough with Ada (nor am I) to know if Ada is endian-independant. I'm almost positive that it's *possible* to make endian-dependant code using unchecked programming (necessary for systems writing). I was wondering, however, if the day-to-day Ada software out there is written endian-independant (i.e. the language facilities used in most day-to-day programming don't depend on whether your architecture is "big" endian or "little" endian.)" To a first approximation, NONE of the semantics of Ada depend on the endianness, you would have to work hard to make an Ada program that worked BE and did not work LE, or vice versa. The issue arises when transporting data between targets of different endianness. One nice approach is to use the stream facilities of Ada in conjuncction with a target independent representation such as XDR. A future version of GNAT will provide the option of using XDR for stream representation to facilitiate this approach (you could program it yourself, but it would be nice to have it built in).