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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Bad cursor, good cursor Date: Mon, 27 Mar 2017 20:12:07 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 27 Mar 2017 18:09:10 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e7d1808d530540a8b1c60ff457164858"; logging-data="14585"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fYUvjHaQRgYhVWYz00ThM8QJpKdLuahs=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Cancel-Lock: sha1:OdtdAtuYzfEDsdrdAZY1VVSTfy0= Xref: news.eternal-september.org comp.lang.ada:46492 Date: 2017-03-27T20:12:07+02:00 List-Id: On 27/03/2017 18:56, Marius Amado-Alves wrote: > Ada 2012 compiled with latest(?) free GNAT (20160515-19) > > This breaks with a "bad cursor" error for Subthing_Maps.Element at line 7. But how can that be, if the cursor has just been vetted at line 6 as not No_Element, and there were no changes to the container meanwhile, not even navigation? > > 1 C := Thing.Find (Thing_ID); > 2 if C = Thing_Maps.No_Element then > 3 Thing.Insert (Thing_ID, Subthing_Maps.Empty_Map, C, Ok); > 4 end if; > 5 I := Subthing_Maps.Find (Thing_Maps.Element (C), Subthing_ID); > 6 if I = Subthing_Maps.No_Element > 7 or else Subthing_Maps.Element (I) = Preterred then > 8 Thing.Update_Element (C, Add_Subthing'Access); > 9 end if; Are Thing_Maps and Thing different? Thing.Insert involves C, which is then passed to Thing_Maps.Element. Just an observation, even though it isn't obviously connected with I. Is there overlap in some form or other, of things involved?