comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: "accessibility check failed" on Node
Date: Thu, 27 Jun 2013 09:36:56 +0200
Date: 2013-06-27T09:36:50+02:00	[thread overview]
Message-ID: <51cbeb92$0$6575$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <kqfrrv$lsb$1@news2.open-news-network.org>

On 27.06.13 01:01, Thomas Schmidt wrote:
> Hi,
>
> I'm new to Ada. I'm trying to write some kind of neural net software. Therefore I've written a small library to implement the neural graph. All nodes are collected in a Hashed_Set. Neurons are specialized Nodes of the graph. To lookup a given Neuron/Node I need the following subprogram "findNode".
>
> Now what I don't understand: Why does "findNode1" work well while "findNode2" raises PROGRAM_ERROR at the line indicated below?

>       position : constant NodeSets.Cursor :=
>         graph.nodes.Find (Node (aNode.all)'Access);    -- <<< Works well

>       position : constant NodeSets.Cursor :=
>         graph.nodes.Find (aNode.all'Access);    -- <<< Raises PROGRAM_ERROR with "accessibility check failed"

The only written difference I see is that the type
of the object whose 'Access is taken in findNode1 is
Node, whereas the type of aNode.all in findNode2
is not necessarily Node. Node is the type used as target
type of what is in the container. If aNode is a pointer
to type that is not declared at the same level as type
Node, then this former type may no longer be
accessible. Therefore, anything specific to the type
is assumed to be gone, including any specific 'Address
operation.

(E.g., Node may be declared at library level, and
Some_Other_Node declared inside some procedure, or
in some generic instance not at library level.)

Some ways of identifying a node can be less troublesome
than using its address. Any identity less accidental
than addresses facilitates persistent identities.

Have you looked at the indefinite containers?


  parent reply	other threads:[~2013-06-27  7:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26 23:01 "accessibility check failed" on Node Thomas Schmidt
2013-06-26 23:45 ` Shark8
2013-06-26 23:58 ` Jeffrey Carter
2013-06-27  7:36 ` Georg Bauhaus [this message]
2013-06-27  7:49 ` Dmitry A. Kazakov
2013-06-27  8:24 ` Simon Wright
2013-06-27 11:19   ` Thomas Schmidt
2013-06-27 12:49     ` Frédéric Praca
2013-06-27 14:36     ` Eryndlia Mavourneen
2013-06-27 17:31       ` Jeffrey Carter
2013-06-27 17:45         ` Simon Wright
2013-06-27 23:26           ` Randy Brukardt
2013-06-28  0:52             ` Jeffrey Carter
2013-06-27 18:33         ` Eryndlia Mavourneen
2013-06-27 20:31           ` Jeffrey Carter
2013-06-27 23:29             ` Randy Brukardt
2013-06-27 14:51     ` Shark8
2013-06-27 17:29     ` Jeffrey Carter
2013-06-27 10:46 ` Stephen Leake
replies disabled

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