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,f25e636d6b770960 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-27 10:13:01 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.vmunix.org!feed.news.nacamar.de!rz.uni-karlsruhe.de!schlund.de!news.online.de!not-for-mail From: "Dr. Michael Paus" Newsgroups: comp.lang.ada Subject: Re: Last stream problem: byte order Date: Wed, 27 Mar 2002 19:12:58 +0100 Organization: =?iso-8859-1?Q?Ingenieurb=FCro?= Dr. Paus Message-ID: <3CA20BAA.FD53C08A@ib-paus.com> References: <3CA04CA6.338B37D7@ib-paus.com> NNTP-Posting-Host: p50830404.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.online.de 1017252779 10048 80.131.4.4 (27 Mar 2002 18:12:59 GMT) X-Complaints-To: abuse@online.de NNTP-Posting-Date: 27 Mar 2002 18:12:59 GMT X-Mailer: Mozilla 4.78 [de] (Win98; U) X-Accept-Language: de Xref: archiver1.google.com comp.lang.ada:21728 Date: 2002-03-27T18:12:59+00:00 List-Id: Erik Sigra schrieb: > > tisdagen den 26 mars 2002 11.25 skrev du: > > If you also check the byte order of your system at runtime (there is a > > system constant in Ada which you can check) you can even achieve the effect > > that all stream data is always written in network byte order independent of > > the platform your program is running on. > > Why runtime check? Compile time check seems more reasonable to me. Or can the > same compiled program really run on architectures with different endiannes? It depends on how clever the compiler is. If the compiler optimizes the static expression in the following if-statement away then it is indeed a compile time check. Otherwise it is a run-time check. if System.Default_Bit_Order = System.Low_Order_First then ... (swap the bytes) else ... (don't swap the bytes) end if; But I don't think this makes a big difference in either case. Michael