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,c370342fe303517b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: C Interface example Date: Tue, 06 Feb 2007 09:20:52 +0100 Organization: CERN News Message-ID: References: <1170516037.435847.326440@p10g2000cwp.googlegroups.com> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: cernne03.cern.ch 1170750053 12552 137.138.37.241 (6 Feb 2007 08:20:53 GMT) X-Complaints-To: news@@cern.ch NNTP-Posting-Date: Tue, 6 Feb 2007 08:20:53 +0000 (UTC) User-Agent: Thunderbird 1.5.0.9 (X11/20061220) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:9009 Date: 2007-02-06T09:20:52+01:00 List-Id: Randy Brukardt wrote: > Anyway, the point is that if you just drop the result on the floor, the Ada > compiler might be allowed to omit the call, too. So it is always best to use > the result somehow. In this case, test it for null and do something > explicit: > > if Result = null then > raise Internal_Error; > end if; > > where Internal_Error is an appropriately defined exception. What about: pragma Assert(Result /= null); It's shorter, looks more "serious" and uses optimistic positive logic instead of a negative one ("I'm alive!" instead of "Let's check whether I'm dead"). The only problem is that there is no choice of exception. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/