comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Ada.Containers and concurrent modification exception.
Date: Wed, 19 Sep 2018 22:16:15 +0200
Date: 2018-09-19T22:16:15+02:00	[thread overview]
Message-ID: <pnuaqh$psk$1@dont-email.me> (raw)
In-Reply-To: <c50e849d-d14c-425d-99f6-75dce5fc3927@googlegroups.com>

On 09/19/2018 03:12 PM, rakusu_klein@fastmail.jp wrote:
> 
> with Ada.Containers.Indefinite_Ordered_Maps;
> ...
>     The_Map : Map;
> ...
> declare
>     I : Cursor := First (The_Map);
>     J : Cursor := First (The_Map);
> begin
>     --  Now Cursors are synchronized with each other and with a container.
>     Delete (The_Map, I);
>     --  It's O'k. But now J lost a sync and points to a dead Node.
>     Next (J);
>     --  What should I expected here,
>     --  any well defined exception or
>     --  raising a zombie?
> end;

The ARM covers this case in ARM A.18.4(76-80) [I am unable to access the current 
ARM right now, so I'm quoting from ISO/IEC 8652:2007, which should be similar]:

"A Cursor value is invalid if ... The node it designates has been deleted from 
the map. The result of "=" or Has_Element is unspecified if these functions are 
called with an invalid cursor parameter. Execution is erroneous if any other 
subprogram declared in Containers.Hashed_Maps or Containers.Ordered_Maps is 
called with an invalid cursor parameter.

So J is invalid and Next (J) is erroneous. ARM 1.1.5(10) defines erroneous 
execution: "there is no language-specified bound on the possible effect of 
erroneous execution; the effect is in general not predictable." In other words, 
this call can do anything.

-- 
Jeff Carter
"I spun around, and there I was, face to face with a
six-year-old kid. Well, I just threw my guns down and
walked away. Little bastard shot me in the ass."
Blazing Saddles
40

  parent reply	other threads:[~2018-09-19 20:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 13:12 Ada.Containers and concurrent modification exception rakusu_klein
2018-09-19 15:22 ` Jacob Sparre Andersen
2018-09-19 16:05   ` Simon Wright
2018-09-19 16:08     ` Jacob Sparre Andersen
2018-09-19 16:47       ` Simon Wright
2018-09-19 16:31     ` Anh Vo
2018-09-19 17:23       ` Anh Vo
2018-09-19 17:37   ` rakusu_klein
2018-09-19 18:05     ` Simon Wright
2018-09-19 15:53 ` Simon Wright
2018-09-19 18:24   ` rakusu_klein
2018-09-21 23:27     ` Randy Brukardt
2018-09-22  1:09       ` rakusu_klein
2018-09-22  8:05         ` Dmitry A. Kazakov
2018-09-22 17:49           ` rakusu_klein
2018-09-22 19:50             ` Dmitry A. Kazakov
2018-09-24 21:47         ` Randy Brukardt
2018-09-25  6:04           ` Petter Fryklund
2018-09-25 22:32             ` Randy Brukardt
2018-09-26  5:01               ` Petter Fryklund
2018-09-19 20:16 ` Jeffrey R. Carter [this message]
2018-09-19 20:56   ` rakusu_klein
2018-09-21 23:21     ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox