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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: How to get nice with GNAT? Date: Sun, 23 Nov 2014 13:49:34 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 23 Nov 2014 20:49:23 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="6bb4f0a3c21c874c69dbcaa30e818f24"; logging-data="19854"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qUNJs/0t1Dpg1OXVM8Th1zuS6lmVWj8Y=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:mkKGI6YwbYJzmZnqtotIv4M5ykk= Xref: news.eternal-september.org comp.lang.ada:23674 Date: 2014-11-23T13:49:34-07:00 List-Id: On 11/23/2014 10:41 AM, brbarkstrom@gmail.com wrote: > > I'm working in GNAT GPL, so my suggestion may not work with every > compiler. > > On the other hand, in my code, the if following the exception in the > procedure is picked up and executed properly. The code doesn't act > like the program has to fail if any exception is raised. I don't think you're talking about exceptions. I took this program: with Ada.Text_IO; procedure Boolean_Exception is procedure Test (OK : out Boolean) is -- empty declarative part begin -- Test OK := False; raise Constraint_Error; end Test; OK : Boolean := True; begin -- Boolean_Exception Test (OK => OK); Ada.Text_IO.Put_Line (Item => "No exception"); exception -- Boolean_Exception when others => Ada.Text_IO.Put_Line (Item => Boolean'Image (OK) ); end Boolean_Exception; compiled with GNAT 4.6 on Linux, and got: $ gnatmake -gnatwa -gnatano -O2 -fstack-check boolean_exception.adb gcc-4.6 -c -gnatwa -gnatano -O2 -fstack-check boolean_exception.adb boolean_exception.adb:6:10: warning: assignment to pass-by-copy formal may have no effect boolean_exception.adb:6:10: warning: "raise" statement may result in abnormal return (RM 6.4.1(17)) gnatbind -x boolean_exception.ali gnatlink boolean_exception.ali -O2 -fstack-check $ ./boolean_exception TRUE What you're talking about doesn't work with GNAT. -- Jeff Carter "This school was here before you came, and it'll be here before you go." Horse Feathers 48