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-Thread: 103376,57b125b84ee7e254 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!nntp.abs.net!news.abs.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Avoiding warnings References: <1140429906.386023.136460@f14g2000cwb.googlegroups.com> From: Stephen Leake Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:qBN6XpdLcTW9+gyTer3Nb/bWmb8= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 22 Feb 2006 17:45:54 -0500 NNTP-Posting-Host: 66.159.65.1 X-Complaints-To: abuse@toad.net X-Trace: news.abs.net 1140648362 66.159.65.1 (Wed, 22 Feb 2006 17:46:02 EST) NNTP-Posting-Date: Wed, 22 Feb 2006 17:46:02 EST Xref: g2news1.google.com comp.lang.ada:3080 Date: 2006-02-22T17:45:54-05:00 List-Id: "ada_wannabe" writes: > Hello everybody. Suppose we have the next code that converts data types > between different architectures: > > procedure p1(..) > begin > ... > if Standard'Default_Bit_Order=1 then > ... > else > ... > end p1; > > When I compile the source, the GNAT compiler gives me the next warning: > > warning: condition is always True > > How can I avoid this warning? Others have shown you how to avoid the warning, but they have not pointed out that the warning is still correct; the 'else' clause of this 'if' statement will _never_ be executed. If you want to write code that converts record layouts between machines of different endianness, you need something different. See SAL.Endianness for one way to do it. http://www.toadmail.com/~ada_wizard/ada/sal.html See Ada Letters September 2005, article by Randal Andress for an extension of this technique. See http://www.ada-auth.org/ai-files/grab_bag/bitorder.pdf for the _right_ way to do it. Unfortunately, GNAT does not implement this. If you care about that, send them an email asking them to implement AI95-00133. If they get enough such emails, they will eventually implement it :). -- -- Stephe