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: Sat, 22 Nov 2014 16:24:12 -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: Sat, 22 Nov 2014 23:24:01 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="6bb4f0a3c21c874c69dbcaa30e818f24"; logging-data="8672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Fet06kcPZPQXfO+dQaTJ/oo2AbFwqT2k=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:h6pvmRRsvvf36idLoN30PwRGcY0= Xref: news.eternal-september.org comp.lang.ada:23651 Date: 2014-11-22T16:24:12-07:00 List-Id: On 11/22/2014 03:44 PM, brbarkstrom@gmail.com wrote: > > One possibility is to get in the habit of putting exception handling > messages in every procedure interface, as in > > procedure DoSomething(stuff; > OK : out Boolean; > Err_Msg : out Bounded_String); > > if DoSomething throws an exception, the calling program can detect > that OK is false and receive a message identifying the cause. This is terrible advice. Boolean is a by-copy type; if the procedure call raises an exception, then no value will have been copied out to the actual parameter. Bounded_String may also be passed by copy. This only works if you never raise exceptions, in which case you might as well use a primitive language without exceptions. -- Jeff Carter "C++ is vast and dangerous, a sort of Mordor of programming languages." Jason R. Fruit 120