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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec3c155a33990ec6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!bigfeed.bellsouth.net!bignumber.bellsouth.net!news.bellsouth.net!bignews5.bellsouth.net.POSTED!84c79386!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada References: <4104d5de@dnews.tpgi.com.au> Subject: Re: "out" and "in out" MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: X-Complaints-To: abuse@bellsouth.net X-Abuse-Info: Please forward a copy of all headers for proper handling X-Trace: ldjgbllpbapjglppdbdpiflmbcekedmfhojhikkbagflhcbompoegilhjklikfhjichhlkdhpcaebldpfppcajklocjgahihdjhnplmkngkepkjmkijhhagfkjbgilpagjckffkeiaohiooopiodllpmipjgakdn NNTP-Posting-Date: Mon, 26 Jul 2004 06:58:28 EDT Organization: BellSouth Internet Group Date: Mon, 26 Jul 2004 06:00:31 -0500 Xref: g2news1.google.com comp.lang.ada:2395 Date: 2004-07-26T06:00:31-05:00 List-Id: "zork" wrote in message news:4104d5de@dnews.tpgi.com.au... > Hi i found the following explaination: > > In Ada, "in" parameters are similar to C++ const parameters. They are > effectively read-only within the scope of the called subprogram. > Ada "in out" parameters have a reliable initial value (that passed > in from the calling subprogram) and may be modified within the scope > of the called procedure. Ada "out" parameters have no reliable > initial value, but are expected to be assigned a value within the > called procedure. > > What does "have no reliable initial value" mean when considering the "out" > parameter? It means that wihn the procedure "modify," if youo attempt to read the value of the formal parameter "s1," it would "have no reliable initial value." It has no bearing on the value of the actual parameter "s." > > By chance I created a small program as follows: > > =========== > s : string := "CAT"; > > procedure modify ( s1 : out string ) is > begin > s1(2) := 'U'; > end modify; > > .. > > put ( modify(s) ); > =========== > > now I get as a result "CUT", and i dont understand why i get this result. > Doesnt the "out" specify that its initial value isnt passed in via the > parameter? But it seems to be passed in the above. In fact the "out" is > acting like an "in out". I am a little confused. Could someone shed some > light on this? > > Many thanks! > > zork > > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada-france.org > http://www.ada-france.org/mailman/listinfo/comp.lang.ada > >