From: "Pat Rogers" <progers@NOclasswideSPAM.com>
Subject: Re: 'Read for pointers
Date: 2000/07/29
Date: 2000-07-29T00:00:00+00:00 [thread overview]
Message-ID: <XBGg5.33$Tc1.42551@nnrp1.sbc.net> (raw)
In-Reply-To: uaef1lxlw.fsf@gsfc.nasa.gov
"Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
news:uaef1lxlw.fsf@gsfc.nasa.gov...
> "Pat Rogers" <progers@NOclasswideSPAM.com> writes:
>
> > "Ted Dennison" <dennison@telepath.com> wrote in message
> > news:8lndgv$1om$1@nnrp1.deja.com...
>
> > > package Example is
> > > type Handle is private;
> > >
> > > ...
> > > private
> > >
> > > type Instance;
> > >
> > > type Handle is access all Instance;
> > >
> > > end Example;
> > >
> > > But there's a problem. Following is the profile for 'Read:
> > >
> > > procedure Read
> > > (Stream : access Ada.Streams.Root_Stream_Type'Class;
> > > Item : out Handle
> > > );
> > > for Handle'Read use Read;
> > >
> > > The problem is that Item is an *out* parameter. That means I
won't
> > have
> > > acces to the pointer's old value inside Read.
> >
> > You can read mode out parameters in Ada 95 (unlike Ada 83). (Am I
> > missing something?)
>
> Yes, you are missing something.
>
> Suppose the user writes:
>
> My_Handle : Handle;
>
> (somehow, My_Handle is given some value)
>
> Read (Stream, My_Handle);
>
> The value of My_Handle is _not_ copied to Item at the procedure
call.
> That only happens for "in" or "in out" parameters, not "out"
> parameters.
Have a look at RM 6.4.1{12,13} for a surprise.
--
Pat Rogers Consulting and Training in:
http://www.classwide.com Deadline Schedulability Analysis
progers@classwide.com Software Fault Tolerance
(281)648-3165 Real-Time/OO Languages
Adam ... does not deserve all the credit; much is due to Eve, the
first woman, and Satan, the first consultant.
Mark Twain
next prev parent reply other threads:[~2000-07-29 0:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-26 0:00 'Read for pointers Ted Dennison
2000-07-26 0:00 ` Pat Rogers
2000-07-26 0:00 ` tmoran
2000-07-26 0:00 ` Pat Rogers
2000-07-27 0:00 ` tmoran
2000-07-26 0:00 ` Pat Rogers
2000-07-27 0:00 ` Ted Dennison
2000-07-27 0:00 ` Pat Rogers
2000-07-27 0:00 ` Ted Dennison
2000-07-27 0:00 ` Pat Rogers
2000-07-26 0:00 ` Pat Rogers
2000-07-28 0:00 ` Stephen Leake
2000-07-28 0:00 ` tmoran
2000-07-29 0:00 ` Pat Rogers [this message]
2000-07-31 0:00 ` Stephen Leake
2000-07-31 0:00 ` Robert A Duff
2000-07-31 0:00 ` Pat Rogers
2000-07-28 0:00 ` Stephen Leake
2000-07-31 0:00 ` Ted Dennison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox