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 R. Carter" Newsgroups: comp.lang.ada Subject: Re: Storage_Error: mine's or gnat's fault? Date: Fri, 3 Jun 2016 15:48:03 -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=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 3 Jun 2016 22:48:05 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="48b46be33beed75863f69afa437f956b"; logging-data="25577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bb3cW+1XoD79uEiNLSK7oaMbs9wCq3ds=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: Cancel-Lock: sha1:CtWxXHBPsbOsrUjuVi18AokKQCw= Xref: news.eternal-september.org comp.lang.ada:30598 Date: 2016-06-03T15:48:03-07:00 List-Id: On 06/03/2016 03:45 PM, Jeffrey R. Carter wrote: > On 06/03/2016 02:43 PM, Alejandro R. Mosteo wrote: >> >> function First_Element (Container : List) return Element_Type is >> begin >> if Checks and then Container.First = null then >> raise Constraint_Error with "list is empty"; >> end if; >> >> return Container.First.Element.all; -- <-- RAISES >> end First_Element; > > What is Checks? If it is/returns False when the list is empty, you'll try to > dereference null. My mistake. That's the code for the container, not your code. -- Jeff Carter "I wave my private parts at your aunties." Monty Python & the Holy Grail 13