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-28 10:35:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Last stream problem: byte order Date: 28 Mar 2002 13:34:24 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3CA04CA6.338B37D7@ib-paus.com> <3CA20BAA.FD53C08A@ib-paus.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1017340780 3834 128.183.220.71 (28 Mar 2002 18:39:40 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 28 Mar 2002 18:39:40 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:21780 Date: 2002-03-28T18:39:40+00:00 List-Id: "Eric G. Miller" writes: > > 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. > > GNAT gives a warning that the condition is always true (or false). > Don't know if it eliminates the unreachable branch (I would think so > with -02). Resorting to preprocessing trickery would probably insure > it is always a compile time check. Don't know if there's another > way... You can have two package bodies, one for Low_Order_First, one for High_Order_First. Choose which body you use at compile time by setting paths (in gnat, this is done in gnat.adc via pragma Source_Name). -- -- Stephe