comp.lang.ada
 help / color / mirror / Atom feed
From: Thomas <fantome.forums.tDeContes@free.fr.invalid>
Subject: Re: Unchecked_Deallocation with tagged types
Date: Sat, 16 Apr 2022 07:00:57 +0200	[thread overview]
Message-ID: <625a4d8a$0$24798$426a34cc@news.free.fr> (raw)
In-Reply-To: b37bc687-b72f-4bc4-858c-77dc9b878cffn@googlegroups.com

In article <b37bc687-b72f-4bc4-858c-77dc9b878cffn@googlegroups.com>,
 Gautier write-only address <gautier_niouzes@hotmail.com> wrote:

> > Well, P'Free can also be in another package... Of course, we are talking 
> > here only about the direct, actual deallocation. 
> > 
> > If you want to precisely know where deallocation is used, use AdaControl 
> > (for any solution). If you want to be confident that there is no direct 
> > deallocation in a module, the generic wins. 
> 
> It loses because you can have direct, immediate deallocation without the 
> "with Ada.Unchecked_Deallocation" somewhere in the context clause.
> 
> pack.ads:
> 
> with Ada.Unchecked_Deallocation;
> package Pack is
>   type IA is access Integer;
>   procedure Release is new Ada.Unchecked_Deallocation (Integer, IA);
> end;
> 
> ----
> proc.adb:
> 
> with Pack;
> procedure Proc is
>   use Pack;
>   P : IA;
> begin
>   P := new Integer;
>   Release (P);
> end;


what J-P. Rosen meant was that P'Free could be in the body of 
Pack.Release, and then it would not be in Proc either.


perso i like the design with the "generic".
(I'm used to it anyway, although of course it's worse than not needing 
explicit Deallocation.)

but the question is: why in the specification ???


actually i need to know more about your case:

- do you find it ok to put the access types in the package 
specification, and then not have control over what they become?

- or don't you want that, but you regularly become in situations where 
you have no choice (for example because you need components of which you 
are not the author)?


what's your opinion about String_Access and Free in 
Ada.Strings.Unbounded?

I don't understand what they are doing here, since this package is made 
to avoid needing them...

-- 
RAPID maintainer
http://savannah.nongnu.org/projects/rapid/

  reply	other threads:[~2022-04-16  5:00 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-17 21:45 Unchecked_Deallocation with tagged types DrPi
2021-04-17 22:29 ` Rod Kay
2021-04-17 22:36   ` Rod Kay
2021-04-18  9:06     ` DrPi
2021-04-18  9:07     ` Jeffrey R. Carter
2021-04-18  8:21 ` Dmitry A. Kazakov
2021-04-18  8:46   ` Gautier write-only address
2021-04-18  9:09     ` Jeffrey R. Carter
2021-04-18 10:13       ` Dmitry A. Kazakov
2022-04-16  3:44         ` Thomas
2022-04-16  8:09           ` Dmitry A. Kazakov
2021-04-18 10:20       ` J-P. Rosen
2021-04-18 10:34         ` Dmitry A. Kazakov
2021-04-18 15:14           ` J-P. Rosen
2021-04-18 15:23             ` Gautier write-only address
2021-04-18 15:53               ` J-P. Rosen
2021-04-18 16:08                 ` Gautier write-only address
2022-04-16  5:00                   ` Thomas [this message]
2021-04-20 18:53               ` Randy Brukardt
2021-04-20 19:35                 ` Dmitry A. Kazakov
2022-04-18  5:51                   ` Thomas
2022-04-18  6:26                     ` Niklas Holsti
2021-04-20 20:32                 ` Jeffrey R. Carter
2021-04-20 21:10                   ` Niklas Holsti
2021-04-21  8:35                     ` Jeffrey R. Carter
2021-04-21 10:11                       ` Dmitry A. Kazakov
2021-04-24  0:49                     ` Randy Brukardt
2022-04-18  1:51                       ` Thomas
2021-04-18 16:08         ` Jeffrey R. Carter
2021-04-18  9:13   ` DrPi
2021-04-18 10:01     ` Dmitry A. Kazakov
2021-04-18 10:42       ` DrPi
2021-04-18 16:48     ` Jeffrey R. Carter
2021-04-20 15:57       ` Stephen Leake
2021-04-20 17:24         ` Jeffrey R. Carter
2021-04-20 17:34           ` Vincent Marciante
2021-04-20 20:56             ` Jeffrey R. Carter
2021-04-21 10:21               ` Vincent Marciante
2021-04-21 10:28                 ` Vincent Marciante
2021-04-21 12:13                 ` Simon Wright
2021-04-21 13:28                 ` J-P. Rosen
2021-04-22 10:21                   ` Vincent Marciante
2021-04-21 13:42                 ` Jeffrey R. Carter
2021-04-24  1:04                 ` Randy Brukardt
2022-04-12 23:25                   ` use clauses Thomas
2022-04-13  1:05                     ` Randy Brukardt
2022-04-14  2:51                       ` 25.BX944
2022-04-14  6:49                         ` Emmanuel Briot
2022-04-15  5:33                         ` Doctor Who
2022-04-19  3:53                       ` Thomas
2022-04-19  5:59                         ` Randy Brukardt
2021-04-22  8:55           ` Unchecked_Deallocation with tagged types Stephen Leake
2021-04-22 11:16             ` Jeffrey R. Carter
2021-04-22 15:49               ` Vincent Marciante
  -- strict thread matches above, loose matches on Subject: below --
1996-11-22  0:00 Paul Burnim
1996-11-23  0:00 ` Simon Wright
replies disabled

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