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,889e505ce067252c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-05 19:34:18 PST Path: nntp.gmd.de!newsserver.jvnc.net!news.cac.psu.edu!news.pop.psu.edu!hudson.lm.com!godot.cc.duq.edu!news.duke.edu!news.mathworks.com!uhog.mit.edu!bloom-beacon.mit.edu!panix!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Ada95 - Determining Machine Byte Order Date: 5 Feb 1995 22:34:18 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3h45bq$fev@gnat.cs.nyu.edu> References: <3gpo58$g48@ixnews3.ix.netcom.com> <3gvudv$k4b@liberator.et.tudelft.nl> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1995-02-05T22:34:18-05:00 List-Id: Not only is Mark's solution: int n = 1, little_endian = (*((char *)&n) == n); not very clear (though if you study it for a second and can find your way around * and & in C, you can see how it works), but more significantly there is no guarantee that this will work, it is equivalent to the use of unchecked conversion in Ada, and equally problematic. Mark if you don't believe me, try seeing what this gives on a Cray, or if you want to take the theoretical approach, tell me where in the ANSI standard it is written that this will do something well defined. All in all I think that the Ada way of doing things: Little_Endian : constant Boolean := System.Default_Bit_Order = System.Low_Order_First; maybe just a *little* bit clearer :-)