From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,65b902127ca8a604 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!news.glorb.com!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp19-2.free.fr!not-for-mail Date: Sat, 27 Jun 2009 14:35:38 +0200 From: Damien Carbonne User-Agent: Thunderbird 2.0.0.22 (X11/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Issue with GNAT GPL 2009 and GtkAda References: <4A414EBB.8060204@free.fr> <1avd65rn49abv$.krcxo2gdzb16$.dlg@40tude.net> <4a43c9ce$0$420$426a74cc@news.free.fr> <4a4537a3$0$441$426a34cc@news.free.fr> <4a460fd7$0$10813$426a74cc@news.free.fr> In-Reply-To: <4a460fd7$0$10813$426a74cc@news.free.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4a46121a$0$414$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 27 Jun 2009 14:35:38 MEST NNTP-Posting-Host: 82.247.219.63 X-Trace: 1246106138 news-3.free.fr 414 82.247.219.63:44924 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:6666 Date: 2009-06-27T14:35:38+02:00 List-Id: 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.