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 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-07 06:56:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!skynet.be!dispose.news.demon.net!demon!newspeer.clara.net!news.clara.net!btnet-peer!btnet!diablo.netcom.net.uk!netcom.net.uk!not-for-mail From: "Ayende Rahien" Newsgroups: comp.lang.ada Subject: Re: Problem understanding procedure Adjust(. Date: Sat, 7 Apr 2001 15:51:19 +0200 Organization: (Posted via) GTS Netcom - Public USENET Service http://pubnews.netcom.net.uk Sender: ayende@softhome.net Message-ID: <9an679$c0c$1@taliesin.netcom.net.uk> References: <9an4ru$al9$1@taliesin.netcom.net.uk> <3ACF1A25.E059BCBC@home.com> NNTP-Posting-Host: diup-181-50.inter.net.il X-Trace: taliesin.netcom.net.uk 986651693 12300 213.8.181.50 (7 Apr 2001 13:54:53 GMT) X-Complaints-To: abuse@corp.netcom.net.uk NNTP-Posting-Date: Sat, 7 Apr 2001 13:54:53 +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:6614 Date: 2001-04-07T15:51:19+02:00 List-Id: "Mark Biggar" wrote in message news:3ACF1A25.E059BCBC@home.com... > Ayende Rahien wrote: > > 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? > > No, Adjust is called on stack1, after a bitwise copy is made > of stack2. The intent is that Adjust can do things like deep copies or > reference count changes. Okay, that clear things up. > > 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? > > STORAGE_ERROR Thanks.