comp.lang.ada
 help / color / mirror / Atom feed
From: "Michal Morawski" <morawski@zsk.p.lodz.pl>
Subject: Re: [announcement] SYSAPI and SYSSVC for Windows
Date: Sun, 21 Dec 2003 18:46:00 +0100
Date: 2003-12-21T18:46:00+01:00	[thread overview]
Message-ID: <bs4ma6$p7s$1@atlantis.news.tpi.pl> (raw)
In-Reply-To: bs4fbr$g8f$1@online.de

Try:
       O.B := O.A(1)'Unchecked_Access; -- This is OK, A(i) are aliased
'Access does not work because in the procedure You are getting address of
the variable (may be) on the stack

Michal Morawski

"Ekkehard Morgenstern" <ekkehard.morgenstern@onlinehome.de> wrote in message
news:bs4fbr$g8f$1@online.de...
>
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
> >   type T is limited private;
> > private
> >    type Integer_Array is array (Integer range <>) of aliased Integer;
> >    type T is limited record
> >       A : Integer_Array (1..3);
> >    end record;
> >
> >    procedure F (O : in out T ) is
> >    begin
> >        ... O.A(1)'Access; -- This is OK, A(i) are aliased
> >    end;
> >
> > If the array elements be tagged, then you would need not write "aliased"
in
> > the array declaration.
>
> try to compile it!
>
> GNAT spat out an error message for it: "non-local pointer cannot point to
local object"
>
> Here's the source, Luke:
>
>  1: procedure ttest0 is
>  2:    type Integer_Array is array (Integer range <>) of aliased Integer;
>  3:    type Integer_Access is access all Integer;
>  4:    type T is limited record
>  5:       A : Integer_Array (1..3);
>  6:       B : Integer_Access;
>  7:    end record;
>  8:    procedure F( O : in out T ) is
>  9:    begin
> 10:        O.B := O.A(1)'Access; -- This is OK, A(i) are aliased
> 11:    end;
> 12:    O1 : T;
> 13: begin
> 14:    F( O1 );
> 15: end ttest0;
>
> ttest0.adb:10:17: non-local pointer cannot point to local object
> gnatmake: "ttest0.adb" compilation error
>
> So, what's wrong with it?
>





  reply	other threads:[~2003-12-21 17:46 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17 19:17 [announcement] SYSAPI and SYSSVC for Windows amado.alves
2003-12-17 19:56 ` Georg Bauhaus
2003-12-18  9:08 ` Dmitry A. Kazakov
2003-12-18 12:14   ` Ekkehard Morgenstern
2003-12-18 13:31     ` Georg Bauhaus
2003-12-19 10:45       ` Ekkehard Morgenstern
2003-12-19 17:12         ` Georg Bauhaus
2003-12-19 17:22           ` Vinzent 'Gadget' Hoefler
2003-12-20  0:21           ` Ekkehard Morgenstern
2003-12-20  2:18             ` Georg Bauhaus
2003-12-20  4:40               ` Ekkehard Morgenstern
2003-12-21  3:45                 ` Georg Bauhaus
2003-12-21 19:01                   ` Piracy was " Robert I. Eachus
2003-12-18 14:32     ` Dmitry A. Kazakov
2003-12-19 11:11       ` Ekkehard Morgenstern
2003-12-19 15:15         ` Hyman Rosen
2003-12-19 15:50           ` Ekkehard Morgenstern
2003-12-19 16:48             ` Hyman Rosen
2003-12-19 16:57               ` Hyman Rosen
2003-12-20  1:17               ` Ekkehard Morgenstern
2003-12-21  2:19                 ` Hyman Rosen
2003-12-21 10:34                   ` Ekkehard Morgenstern
2003-12-22  9:02                     ` Hyman Rosen
2003-12-22 15:17                       ` Ekkehard Morgenstern
2003-12-22 15:08                     ` Hyman Rosen
2003-12-22 15:31                       ` Ekkehard Morgenstern
2003-12-22 16:35                         ` Ekkehard Morgenstern
2003-12-23  1:47                           ` Hyman Rosen
2003-12-23  8:40                             ` Ekkehard Morgenstern
2003-12-23  9:05                               ` Stephen Leake
2003-12-19 17:06         ` Dmitry A. Kazakov
2003-12-20  1:49           ` Ekkehard Morgenstern
2003-12-20 11:13             ` Dmitry A. Kazakov
2003-12-20 13:40               ` Ekkehard Morgenstern
2003-12-20 17:21                 ` Dmitry A. Kazakov
2003-12-20 19:52                   ` Ekkehard Morgenstern
2003-12-21  4:24                     ` Georg Bauhaus
2003-12-21 13:42                     ` Dmitry A. Kazakov
2003-12-21 15:48                       ` Ekkehard Morgenstern
2003-12-21 17:46                         ` Michal Morawski [this message]
2003-12-21 18:05                           ` Ekkehard Morgenstern
2003-12-22  0:50                             ` Robert I. Eachus
2003-12-23 23:02                       ` Robert A Duff
2003-12-24 11:20                         ` Dmitry A. Kazakov
2003-12-24 16:57                           ` Robert A Duff
2003-12-25 14:00                             ` Dmitry A. Kazakov
2003-12-28  1:49                       ` Dave Thompson
  -- strict thread matches above, loose matches on Subject: below --
2003-12-15 14:18 Ekkehard Morgenstern
2003-12-15 15:10 ` Ekkehard Morgenstern
2003-12-15 17:10 ` Jeffrey Carter
2003-12-15 18:38   ` Ekkehard Morgenstern
2003-12-16  0:25     ` Stephen Leake
2003-12-16  0:56       ` Ekkehard Morgenstern
2003-12-16  2:47         ` Ludovic Brenta
2003-12-16 17:45           ` Ekkehard Morgenstern
2003-12-16 19:54             ` Ludovic Brenta
2003-12-16 22:09               ` Ekkehard Morgenstern
2003-12-17 15:24                 ` Ludovic Brenta
2003-12-17 23:23                   ` Ekkehard Morgenstern
2003-12-19 18:14                   ` Warren W. Gay VE3WWG
2003-12-16  5:36         ` tmoran
2003-12-16 17:30           ` Ekkehard Morgenstern
2003-12-15 20:44 ` David Marceau
2003-12-16  0:34   ` Ekkehard Morgenstern
2003-12-17 12:05 ` Dmitry A. Kazakov
2003-12-17 15:00   ` Ekkehard Morgenstern
2003-12-20 19:24 ` Ekkehard Morgenstern
replies disabled

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