comp.lang.ada
 help / color / mirror / Atom feed
From: Mario Blunk <mario.blunk.gplus@gmail.com>
Subject: Re: strange cursor in nested containers
Date: Tue, 25 Apr 2023 00:30:37 -0700 (PDT)	[thread overview]
Message-ID: <9a1c3ba5-d5ae-41d3-9eab-2b8cd941bc66n@googlegroups.com> (raw)
In-Reply-To: <u2199a$3cm0v$1@dont-email.me>

> > How could I solve the problem ? Not using "rename" ? Using an aliased access type as John Barnes suggests in Ada2005 on page 275 ?
> You have to avoid calling Element. Since you have a cursor, you can call 
> Query_Element, which should pass the actual element to the procedure you supply. 

Right, that solves the problem. For those interested please find a comparison here:

1. The demo with a dangling (dangerous) cursor:
https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_1.adb

And the demo with the issue solved properly:
https://github.com/Blunk-electronic/ada_training/blob/master/src/containers/demo/nested/nest_2.adb

Still the question remains, why such a dangling cursor is not detected at runtime.

  reply	other threads:[~2023-04-25  7:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  7:09 strange cursor in nested containers Mario Blunk
2023-04-19 15:07 ` Simon Wright
2023-04-20  5:15 ` Egil H H
2023-04-20  5:33   ` Egil H H
2023-04-20 14:59   ` Simon Wright
2023-04-20 15:28     ` Mario Blunk
2023-04-22  9:33       ` Randy Brukardt
2023-04-22 17:04         ` Mario Blunk
2023-04-22 18:33           ` Jeffrey R.Carter
2023-04-25  7:30             ` Mario Blunk [this message]
2023-05-09  3:56               ` Randy Brukardt
2023-05-09  8:36                 ` Jeffrey R.Carter
2023-05-09  8:49                   ` Dmitry A. Kazakov
replies disabled

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