comp.lang.ada
 help / color / mirror / Atom feed
* Problem understanding procedure Adjust(.
@ 2001-04-07 13:28 Ayende Rahien
  2001-04-07 13:45 ` Mark Biggar
  2001-04-08  2:28 ` Jeffrey Carter
  0 siblings, 2 replies; 5+ messages in thread
From: Ayende Rahien @ 2001-04-07 13:28 UTC (permalink / 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









^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-04-08 12:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-07 13:28 Problem understanding procedure Adjust( Ayende Rahien
2001-04-07 13:45 ` Mark Biggar
2001-04-07 13:51   ` Ayende Rahien
2001-04-08  2:28 ` Jeffrey Carter
2001-04-08 12:04   ` Ayende Rahien

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