comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: two questions on allocators
Date: Fri, 23 Feb 2018 14:30:04 -0800 (PST)
Date: 2018-02-23T14:30:04-08:00	[thread overview]
Message-ID: <ca45302e-8a1a-4331-ac39-ffa14debc8c8@googlegroups.com> (raw)
In-Reply-To: <93229821-ae3d-4e47-91d9-a20ff3c1f1a7@googlegroups.com>

On Friday, February 23, 2018 at 1:42:14 PM UTC-7, Mehdi Saada wrote:
> 2.2/3: for an allocator with a subtype indication, the subtype indication shall not specify a null exclusion
> why 
> type A is access INTEGER;
> type B is access not null A; 
> type C is access B;
> Object_C : C := new B;
> is allowed, but not
> type A is access INTEGER;
> type B is access A; 
> type C is access B;
> Object_C : C := new not null B; ?? What's the difference ?

Lots.
In the first one, A is an access to an integer, B is an access to A (with null exclusion), and C is an access to B... so in C/C++ something like int*, int**, and int***, respectively.

The second is the same insofar as the C/C++ analog is concerned; but it's different in that B doesn't exclude Null.

Finally, the phrase "new not null B" is in error, as you cannot say "new not null" in Ada.


> If the designated type of the allocator is class-wide, the accessibility level of the type determined by the subtype_indication or qualified_expression shall not be statically deeper than that of the type of the allocator.
> 
> -> what means the last "type of the allocator" ? Is it the same than "designed type of the allocator" ?

The type of the allocator refers to a concrete instance of System.Storage_Pools.Root_Storage_Pool which can be associated with an access-type via pragma/aspect.

  reply	other threads:[~2018-02-23 22:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-23 20:42 two questions on allocators Mehdi Saada
2018-02-23 22:30 ` Shark8 [this message]
2018-02-23 23:30   ` Mehdi Saada
2018-02-25  2:17     ` Randy Brukardt
2018-02-24 10:20   ` AdaMagica
2018-02-24 10:18 ` AdaMagica
2018-02-25 12:12 ` Mehdi Saada
2018-02-26 23:02   ` Randy Brukardt
2018-02-28 16:09   ` Robert A Duff
2018-02-28 23:37     ` Randy Brukardt
2018-03-01  8:30       ` Dmitry A. Kazakov
2018-03-01 23:17       ` Robert A Duff
2018-03-01 23:47         ` Shark8
2018-03-02  9:20         ` Simon Wright
2018-03-02 22:37           ` Randy Brukardt
2018-03-02 22:31         ` Randy Brukardt
replies disabled

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