comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Ada Alternatives to Unrestricted_Access
Date: Mon, 12 Mar 2018 17:28:03 +0100
Date: 2018-03-12T17:28:03+01:00	[thread overview]
Message-ID: <p869qj$mhq$1@dont-email.me> (raw)
In-Reply-To: <cbefecf5-5178-43c6-8544-51b9b64f56bc@googlegroups.com>

On 03/11/2018 08:53 PM, Jere wrote:
> 
> procedure Debug_Print(C : Container) is
> begin
>     for E of C loop
>        Ada.Text_IO.Put_Line(Element'Image(E));
>     end loop;
> end Debug_Print;
> 
> procedure Nefarious(C : in out Container) is
> begin
>     for E of C loop
>        if E = Some_Value then
>           <do some stuff>
>           C.Delete(E);  -- tamper check!
>     end loop;
> end Nefarious;

If you can't do both with standard, checked programming, then user-defined 
iteration is broken.

> It's all pre-existing code.  I don't want to add anything.  The
> iteration was already there.  The owner asked to see if I could
> get rid of some GNAT specific extensions easily.
> One was the use of Unrestricted_Access, which led me to the original
> question.  They didn't want a major overhaul of the code.

Address-to-access conversions should be correct and portable, but 
'Unrestricted_Access is probably clearer.

-- 
Jeff Carter
"We'll make Rock Ridge think it's a chicken
that got caught in a tractor's nuts!"
Blazing Saddles
87

  reply	other threads:[~2018-03-12 16:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 20:11 Ada Alternatives to Unrestricted_Access Jere
2018-03-07 20:38 ` Dmitry A. Kazakov
2018-03-07 22:29   ` Jere
2018-03-08  8:27     ` Dmitry A. Kazakov
2018-03-09  0:43       ` Jere
2018-03-09  0:52         ` Jere
2018-03-09  8:28           ` Dmitry A. Kazakov
2018-03-11  0:31             ` Jere
2018-03-08  3:18 ` gautier_niouzes
2018-03-09  0:41   ` Jere
2018-03-08 17:51 ` Jeffrey R. Carter
2018-03-09  0:36   ` Jere
2018-03-09 16:46     ` Jeffrey R. Carter
2018-03-11  0:38       ` Jere
2018-03-11  9:57         ` Jeffrey R. Carter
2018-03-11 10:44           ` Dmitry A. Kazakov
2018-03-11 14:31           ` Jere
2018-03-11 15:49             ` Jeffrey R. Carter
2018-03-11 17:33               ` Jere
2018-03-11 18:12                 ` Jeffrey R. Carter
2018-03-11 19:53                   ` Jere
2018-03-12 16:28                     ` Jeffrey R. Carter [this message]
2018-03-11 18:27                 ` Niklas Holsti
2018-03-11 20:07                   ` Jere
2018-03-12 23:35                     ` Randy Brukardt
2018-03-12 23:30         ` Randy Brukardt
2018-03-13  7:46           ` Niklas Holsti
replies disabled

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