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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,573be8c453ecbff4 X-Google-Attributes: gid103376,public From: "Pat Rogers" Subject: Re: 'Read for pointers Date: 2000/07/29 Message-ID: #1/1 X-Deja-AN: 652237842 References: <8lndgv$1om$1@nnrp1.deja.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Complaints-To: abuse@swbell.net X-Trace: nnrp1.sbc.net 964900343 208.191.184.67 (Sat, 29 Jul 2000 14:52:23 CDT) Organization: SBC Internet Services X-MSMail-Priority: Normal NNTP-Posting-Date: Sat, 29 Jul 2000 14:52:23 CDT Newsgroups: comp.lang.ada Date: 2000-07-29T00:00:00+00:00 List-Id: "Stephen Leake" wrote in message news:uaef1lxlw.fsf@gsfc.nasa.gov... > "Pat Rogers" writes: > > > "Ted Dennison" 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