From: evangeli@cnam.fr (Evangelista Sami)
Subject: in-out and out parameters
Date: 26 Feb 2004 06:00:35 -0800
Date: 2004-02-26T06:00:35-08:00 [thread overview]
Message-ID: <5f59677c.0402260600.3c27ad66@posting.google.com> (raw)
hello
i have this program :
====================
procedure Test is
task T is
entry E(I : out Integer;
J : in out Integer);
end T;
task body T is
begin
accept E(I : out Integer;
J : in out Integer) do
I := 1;
J := J * I;
J := J * J;
end E;
end;
I : Integer := 10;
begin
T.E(I, I);
Put_Line(Integer'Image(I));
end;
====================
The output is 1.
I thought that, as I and J were passed by references, when i call E
with the
same variables, I and J denote the same object. so i was expecting to
get 100 in output.
If someone had a clear explanation i would be very thankful.
next reply other threads:[~2004-02-26 14:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-26 14:00 Evangelista Sami [this message]
2004-02-26 14:18 ` in-out and out parameters Frank J. Lhota
2004-02-26 14:23 ` Jacob Sparre Andersen
2004-02-26 14:29 ` Jean-Pierre Rosen
2004-02-26 14:30 ` Hyman Rosen
2004-02-27 23:54 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox