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 19:29:55 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!news.maxwell.syr.edu!jfk3-feed1.news.digex.net!atl1-feed1.news.digex.net!intermedia!cyclone2.usenetserver.com!news-out.usenetserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3ACFCCC6.9B4C9162@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Problem understanding procedure Adjust(. References: <9an4ru$al9$1@taliesin.netcom.net.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 08 Apr 2001 02:28:32 GMT NNTP-Posting-Host: 209.86.200.2 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 986696912 209.86.200.2 (Sat, 07 Apr 2001 19:28:32 PDT) NNTP-Posting-Date: Sat, 07 Apr 2001 19:28:32 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: supernews.google.com comp.lang.ada:6629 Date: 2001-04-08T02:28:32+00:00 List-Id: Ayende Rahien wrote: > > As far as I understand, this procedure [Adjust] 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. To fully understand what happens here (assignment to a variable of a controlled type), first Finalize is called with Stack1 as its actual parameter ("Stack1 is finalized."). The Stack2's bit pattern is copied into Stack1's memory space ("assignment"). Then Adjust is called with Stack1 as its actual parameter ("Stack1 is adjusted."). So, it the stack type is implemented as a dynamically allocated linked list, Finalize would free the list, one node at a time. After assignment, both stacks would point at the same linked list. Adjust would then make a deep copy of Stack2's linked list for Stack1 to point at. -- Jeff Carter "We call your door-opening request a silly thing." Monty Python & the Holy Grail