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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d27da90d4e621e8d,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-07 06:31:59 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!newsfeeds.belnet.be!news.belnet.be!newsfeed.online.be!diablo.netcom.net.uk!netcom.net.uk!not-for-mail From: "Ayende Rahien" Newsgroups: comp.lang.ada Subject: Problem understanding procedure Adjust(. Date: Sat, 7 Apr 2001 15:28:58 +0200 Organization: (Posted via) GTS Netcom - Public USENET Service http://pubnews.netcom.net.uk Sender: ayende@softhome.net Message-ID: <9an4ru$al9$1@taliesin.netcom.net.uk> NNTP-Posting-Host: diup-181-50.inter.net.il X-Trace: taliesin.netcom.net.uk 986650305 10921 213.8.181.50 (7 Apr 2001 13:31:45 GMT) X-Complaints-To: abuse@corp.netcom.net.uk NNTP-Posting-Date: Sat, 7 Apr 2001 13:31:45 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.60.2296.0000 X-MimeOLE: Produced By Microsoft MimeOLE V5.60.2296.0000 Xref: supernews.google.com comp.lang.ada:6610 Date: 2001-04-07T15:28:58+02:00 List-Id: I'm currently learning Ada from http://adahome.com/Tutorials/Lovelace/, I reached the part where he talk about access variables (http://adahome.com/Tutorials/Lovelace/s12sf.htm) And I'm trying to read this package's body (http://adahome.com/Tutorials/Lovelace/genestac.adb) My problem is with this procedure: procedure Adjust(Object : in out Stack) is -- ... end Adjust; As far as I understand, this procedure is called if I do assignment on stacks (which is what this package is about). If I got it correctly, when I do: stack1 := stack2; The Adjust procedure will be called. Now, Object seems to be the variable on the right side (stack2), if so, how come that stack1 get a new copy of the contents of stack2, without stack2 being affected? Object is an in ou parameter, this mean that changes that are done inside the procedure will persist after the procedure terminate, right? So how do stack1 get a copy of stack2 without destroy stack2? Another question, when using new, how do I find out if the memory allocation was unsuccessful? I assume that an exception is raise, is this correct? If so, what is it? Thanks in advance, Ayende Rahien