From: Damien Carbonne <damien.carbonne@free.fr>
Subject: Re: Issue with GNAT GPL 2009 and GtkAda
Date: Sat, 27 Jun 2009 14:35:38 +0200
Date: 2009-06-27T14:35:38+02:00 [thread overview]
Message-ID: <4a46121a$0$414$426a74cc@news.free.fr> (raw)
In-Reply-To: <4a460fd7$0$10813$426a74cc@news.free.fr>
Damien Carbonne a �crit :
> Stephen Leake a �crit :
>>>>
>>>> ...
>>> If what you say is true, why does the following example work fine
>>> (using GNAT), without any compiler warning or execution error ?
>>
>> Because the object being passed is explicitly labeled "aliased"; that
>> means 'Access is allowed. See my other post from today.
>>
> In the example, there is only one place where an object is explicitly
> declared and labeled "aliased" : in Main.
> In signatures of P[123]M, X is not aliased (only in, out or in out modes).
> There is no "aliased" key word in the bodies of corresponding procedures.
>
> e.g.:
> procedure P1M (X : in out Base; Max_Depth : Positive) is
> begin
> Ada.Text_IO.Put_Line (Indent (Max_Depth) & "P1M" & Positive'Image
> (Max_Depth));
> if Max_Depth > 1 then
> P1A (X'Access, Max_Depth - 1); -- Here use of Access on a tyoe
> that is implicitely aliased
> X.P1A (Max_Depth - 1);
> end if;
> end P1M;
> Nowhere X is explicitely declared aliased. It is only an "in out" tagged
> parameter. It is however possible to use X'Access, in my mind because X
> is tagged (and so passed by reference).
>
> Do you mean that the fact that X is labeled "aliased" in Main is
> propagated everywhere it is used ? I would find this strange (and
> certainly needing a special support from compiler).
>
> I really don't see the difference with the initial problem, where all
> types are tagged types or interfaces.
I would add that if declaration of X is changed to:
type Base is null record; -- no more tagged
and that the object notation lines are removed, the compiler complains:
pack03.adb:15:15: prefix of "Access" attribute must be aliased
...
procedure P1M (X : in out Base; Max_Depth : Positive) is
begin
Ada.Text_IO.Put_Line (Indent (Max_Depth) & "P1M" & Positive'Image
(Max_Depth));
if Max_Depth > 1 then
P1A (X'Access, Max_Depth - 1); -- line 15
end if;
end P1M;
This behaves as expected (by me).
So a tagged type is really and always aliased, whatever its mode (in,
out, in out) is. At least, this is what understand from those examples.
next prev parent reply other threads:[~2009-06-27 12:35 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 21:52 Issue with GNAT GPL 2009 and GtkAda Damien Carbonne
2009-06-24 7:40 ` Dmitry A. Kazakov
2009-06-24 10:15 ` Stephen Leake
2009-06-25 9:06 ` Stephen Leake
2009-06-25 9:39 ` Dmitry A. Kazakov
2009-06-25 19:02 ` Damien Carbonne
2009-06-26 9:31 ` Stephen Leake
2009-06-26 11:18 ` Niklas Holsti
2009-06-26 16:29 ` Damien Carbonne
2009-06-26 17:28 ` Dmitry A. Kazakov
2009-06-26 19:27 ` Damien Carbonne
2009-06-26 19:50 ` Dmitry A. Kazakov
2009-06-26 21:51 ` Randy Brukardt
2009-06-27 11:11 ` Stephen Leake
2009-06-27 17:04 ` Robert A Duff
2009-06-30 11:11 ` Stephen Leake
2009-06-30 18:10 ` Robert A Duff
2009-06-29 22:11 ` Randy Brukardt
2009-06-30 11:13 ` Stephen Leake
2009-06-30 15:26 ` Adam Beneschan
2009-06-30 15:59 ` Adam Beneschan
2009-06-30 23:11 ` Randy Brukardt
2009-06-27 9:56 ` Stephen Leake
2009-06-26 21:03 ` Damien Carbonne
2009-06-27 11:21 ` Stephen Leake
2009-06-27 12:25 ` Damien Carbonne
2009-06-27 12:35 ` Damien Carbonne [this message]
2009-06-29 22:15 ` Randy Brukardt
2009-07-01 19:22 ` Damien Carbonne
2009-06-30 0:48 ` Adam Beneschan
2009-06-30 11:18 ` Stephen Leake
2009-06-25 20:49 ` Randy Brukardt
2009-06-26 7:20 ` Dmitry A. Kazakov
2009-06-26 8:17 ` Georg Bauhaus
2009-06-26 8:52 ` Dmitry A. Kazakov
2009-06-26 21:38 ` Randy Brukardt
2009-06-27 7:47 ` Dmitry A. Kazakov
2009-06-29 21:59 ` Randy Brukardt
2009-06-30 8:31 ` Dmitry A. Kazakov
2009-06-26 21:31 ` Randy Brukardt
2009-06-27 7:53 ` Dmitry A. Kazakov
2009-06-26 8:39 ` Alex R. Mosteo
2009-06-26 9:07 ` Dmitry A. Kazakov
2009-06-27 9:53 ` Stephen Leake
2009-06-26 21:40 ` Randy Brukardt
2009-06-29 10:04 ` Alex R. Mosteo
2009-06-26 9:02 ` Stephen Leake
2009-06-26 9:14 ` 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