comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Biggar <mark.a.biggar@home.com>
Subject: Re: Problem understanding procedure Adjust(.
Date: Sat, 07 Apr 2001 13:45:44 GMT
Date: 2001-04-07T13:45:44+00:00	[thread overview]
Message-ID: <3ACF1A25.E059BCBC@home.com> (raw)
In-Reply-To: 9an4ru$al9$1@taliesin.netcom.net.uk

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.
 
> 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



  reply	other threads:[~2001-04-07 13:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-07 13:28 Problem understanding procedure Adjust( Ayende Rahien
2001-04-07 13:45 ` Mark Biggar [this message]
2001-04-07 13:51   ` Ayende Rahien
2001-04-08  2:28 ` Jeffrey Carter
2001-04-08 12:04   ` Ayende Rahien
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox