comp.lang.ada
 help / color / mirror / Atom feed
From: NiGHTS <nights@unku.us>
Subject: Re: Error: "non-local pointer cannot point to a local object"
Date: Wed, 12 Sep 2018 07:47:53 -0700 (PDT)
Date: 2018-09-12T07:47:53-07:00	[thread overview]
Message-ID: <9a44824f-2897-48f0-92b1-3e9528147ef6@googlegroups.com> (raw)
In-Reply-To: <pnaf3k$1kv6$1@gioia.aioe.org>

On Wednesday, September 12, 2018 at 3:26:46 AM UTC-4, Dmitry A. Kazakov wrote:

> What goal? It looks like a bad design. Copying pointers to integers is 
> asking for trouble.

The integer was chosen to simplify the example. In the actual application it is a tree container, where there is a single thread that is expected to manipulate various contexts of the same tree, thus multiple working records for the same tree.

> 
> BTW, if you used Ada.Finalization.Controlled, as you likely should, and 
> derived one record from another then default copying before Adjust would 
> copy pointer too. What would happen with access info, I have no idea, 
> probably copied as-is. (Yet another reason not to use anonymous access 
> types inside records unless for Rosen's trick or access-to-constant)
> 
While my example does not show Ada.Finalization.Controlled in use, my application's record indeed is derived from this object. Still, I am not sure how overriding Adjust would be applied to my example. Would you show me a quick and dirty example of how this would be done?

> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

  reply	other threads:[~2018-09-12 14:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 22:20 Error: "non-local pointer cannot point to a local object" NiGHTS
2018-09-12  1:49 ` Brad Moore
2018-09-12 14:41   ` NiGHTS
2018-09-12  6:05 ` rakusu_klein
2018-09-12 14:42   ` NiGHTS
2018-09-12  7:26 ` Dmitry A. Kazakov
2018-09-12 14:47   ` NiGHTS [this message]
2018-09-12 15:22     ` 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