comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Qs re 'Write & 'Read
Date: Tue, 10 Jun 2003 20:31:36 -0500
Date: 2003-06-10T20:31:36-05:00	[thread overview]
Message-ID: <MuvFa.22020$LX.19461@fe03.atl2.webusenet.com> (raw)
In-Reply-To: nOtFa.1188350$F1.139910@sccrnsc04


<tmoran@acm.org> wrote in message news:nOtFa.1188350$F1.139910@sccrnsc04...
> >Maybe my mind's just in a fog today, but please explain why there'd be
> >a problem with any kind of access type -- general, or not, using my
> >approach.
>   Aliasing.
>   type phs is access integer;
>   type pgs is access all integer;
>   type r is record
>     i : aliased integer;
>     ph : phs;
>     pg : pgs;
>   end record;
>   x : r;
> begin
>   x.ph := new integer;
>   x.pg := x.i'access;
> but on reading it back in, you can tell both x.ph and x.pg are non-null,
> but you don't know whether x.pg should allocate from the heap or point
> to some existing (stack) object.

Well, for the life of me, I can't see why anyone would need to do what
your example does.  If, indeed, an access component of a record designates
an aliased component, then it seems to me that one would need an overridden
set of stream attributes for the whole record.  Writing r.pg to the stream
would be meaningless, since it designates data already written to the
stream.

The read attribute would simply make the assignment r.pg = r.i'access, after
having read r.i from the stream.

> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>





  reply	other threads:[~2003-06-11  1:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-10  6:11 Qs re 'Write & 'Read tmoran
2003-06-10 12:53 ` Rodrigo Garcia
2003-06-10 17:55 ` David C. Hoos
2003-06-10 19:09   ` tmoran
2003-06-10 21:30     ` David C. Hoos
2003-06-10 23:26       ` tmoran
2003-06-11  1:31         ` David C. Hoos [this message]
2003-06-11 19:19       ` Thomas Wolf
2003-06-12 10:12         ` 
replies disabled

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