comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Reference counter in smart pointers are not updated properly when used by multiple tasks
Date: Thu, 1 Feb 2018 21:12:37 +0100
Date: 2018-02-01T21:12:37+01:00	[thread overview]
Message-ID: <p4vsbm$uav$1@dont-email.me> (raw)
In-Reply-To: <2a706673-45d2-4cfa-805f-4a7d0086f721@googlegroups.com>

On 02/01/2018 08:37 PM, onox wrote:
> On Thursday, February 1, 2018 at 3:48:10 PM UTC+1, Jeffrey R. Carter wrote:
>> Set's parameter Free is an anonymous access-to-subprogram parameter; one is not
>> supposed to be able to assign those and call them later, but that is exactly
>> what this code does. Is this code legal? GNAT compiles it fine. If it is legal,
>> should it be?
> 
> I hope so. When I instantiate the Orka.Smart_Pointers package, I do not know how to free the Object_Type (access to an interface). Only when I call Set I know how to free the object (access to a tagged type implementing the interface).

AIUI, it should be illegal. Because Ada has nested subprograms, it's possible 
that the subprogram won't exist when you call it. To prevent that from happening 
is why named access-to-subprogram types are subject to accessibility checks. 
Anonymous access-to-subprogram parameters don't have such checks because you're 
not supposed to be able to copy them.

-- 
Jeff Carter
"My mind is aglow with whirling, transient nodes of
thought, careening through a cosmic vapor of invention."
Blazing Saddles
85

  reply	other threads:[~2018-02-01 20:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01  5:52 Reference counter in smart pointers are not updated properly when used by multiple tasks onox
2018-02-01  8:39 ` Dmitry A. Kazakov
2018-02-01 10:01   ` onox
2018-02-01 10:28     ` onox
2018-02-01 10:51       ` Dmitry A. Kazakov
2018-02-01 10:57     ` Dmitry A. Kazakov
2018-02-01  8:41 ` Simon Wright
2018-02-01 14:48 ` Jeffrey R. Carter
2018-02-01 19:37   ` onox
2018-02-01 20:12     ` Jeffrey R. Carter [this message]
2018-02-02  0:09   ` Randy Brukardt
2018-02-01 19:04 ` Robert A Duff
replies disabled

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