comp.lang.ada
 help / color / mirror / Atom feed
From: "Ayende Rahien" <Dont@spam.me>
Subject: Problem understanding procedure Adjust(.
Date: Sat, 7 Apr 2001 15:28:58 +0200
Date: 2001-04-07T15:28:58+02:00	[thread overview]
Message-ID: <9an4ru$al9$1@taliesin.netcom.net.uk> (raw)

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









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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-07 13:28 Ayende Rahien [this message]
2001-04-07 13:45 ` Problem understanding procedure Adjust( Mark Biggar
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